/* Mentzai Ops: the Claude Design classes, re-implemented from the artboards.
 *
 * static/css/ds/ is the design system, copied unchanged from the Claude Design project and
 * loaded first; this file only extends it. Class names and values come from the Part 1
 * frames: 1a "Componentes / Referencia", the shells, Login and Admin / Definicoes, then the
 * Dados mestre frames, with the tones and cell kinds from ops-data.js. Where a frame has no
 * class for an element, the name here says what it is (status-strip, login-brand...).
 */

/* ---- App tokens ---------------------------------------------------------------------- */

:root {
  /* The design lever primaryTone defaults to citrus in every Ops frame (ops-data.js). */
  --primary: #daf537;
  --on-primary: #0b1b33;
  --primary-hover: #c8e62a;
  /* Dialog and drawer scrim, and the drawer's shadow. */
  --scrim: rgba(7, 19, 42, 0.72);
  --drawer-shadow: -12px 0 32px rgba(7, 19, 42, 0.24);
}

/* Night mode: static/js/theme.js sets data-theme on <html> and the design system's dark
   tokens do the rest. Two app tokens flip with them. --navy-ink is navy as a foreground (text,
   borders, rings, dots, the meter's counted days), which at night would sit on midnight, so it
   takes the link blue. --on-status is the text on a solid status fill (success, warning,
   danger, a chosen day): white by day, midnight at night, when those fills are light. */
:root, [data-theme="light"] {
  color-scheme: light;
  --navy-ink: var(--navy);
  --on-status: #ffffff;
}
[data-theme="dark"] {
  color-scheme: dark;
  --navy-ink: var(--link);
  --on-status: var(--midnight);
}
/* The mark in reverse on dark grounds (white tile, midnight M), as the brand book says. */
[data-theme="dark"] .mark-tile { fill: #ffffff; }
[data-theme="dark"] .mark-letter { fill: var(--midnight); }

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Saltar para o conteúdo (templates/layouts/app.html): out of sight until the keyboard
   reaches it, then over the top left corner. The page it leads to takes the focus without a
   ring: it is where reading starts, not a control. */
.skip-link { position: absolute; top: 8px; left: 8px; z-index: 100; padding: 8px 16px; border-radius: var(--radius-md); background: var(--surface-raised); color: var(--link); font-weight: 700; transform: translateY(-200%); }
.skip-link:focus { transform: none; }
.app-main:focus { outline: none; box-shadow: none; }
/* Windows' contrast themes drop box-shadow, which is the design system's focus ring: an
   outline in the theme's own colour takes its place there. */
@media (forced-colors: active) {
  :focus-visible, .dropzone:focus-within { outline: 2px solid Highlight !important; outline-offset: 2px; }
}

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.mark, .icon { display: block; flex: none; }
.muted { color: var(--ink-muted); }
[hidden] { display: none !important; }

/* ---- Buttons (DS Button: 40 px, dense 36 px in headers and dialogs, 44 px on mobile) -- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: var(--control-height);
  padding: 0 var(--space-4);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 24px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--motion-fast), color var(--motion-fast);
}
.button:hover { text-decoration: none; }
.button--primary { background: var(--primary); color: var(--on-primary); }
.button--primary:hover { background: var(--primary-hover); color: var(--on-primary); }
.button--secondary { background: var(--surface-raised); color: var(--ink); border-color: var(--line-strong); }
.button--secondary:hover { background: var(--surface-sunken); color: var(--ink); }
.button--tertiary { background: transparent; color: var(--link); padding: 0 var(--space-1); }
.button--tertiary:hover { color: var(--link); text-decoration: underline; text-underline-offset: 2px; }
.button--destructive { background: var(--surface-raised); color: var(--danger); border-color: var(--danger); }
.button--destructive:hover { background: var(--surface-sunken); color: var(--danger); }
/* Table verbs and small actions read as links. */
.button--link {
  height: auto;
  padding: 0;
  border: 0;
  background: none;
  color: var(--link);
  font-size: inherit;
  line-height: inherit;
}
.button--link:hover { color: var(--link); text-decoration: underline; text-underline-offset: 2px; }
.button:disabled,
.button[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
/* A disabled button keeps its own fill under the pointer. */
.button--primary:disabled:hover { background: var(--primary); }
.button--secondary:disabled:hover,
.button--destructive:disabled:hover { background: var(--surface-raised); }
.button--tertiary:disabled:hover,
.button--link:disabled:hover { text-decoration: none; }
/* The button pressed while its form is on its way (static/js/app.js): lit, with a small ring
   turning after its word, not greyed out like a disabled one. */
form[aria-busy="true"] { cursor: progress; }
.button.button--busy { opacity: 1; cursor: progress; }
.button--busy::after { content: ""; flex: none; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: button-busy 0.8s linear infinite; }
@keyframes button-busy { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .button--busy::after { animation: none; border-right-color: currentColor; opacity: 0.5; } }
.page-header .button:not(.button--link),
.confirm-dialog .button:not(.button--link) {
  height: var(--control-height-dense);
  font-size: 14px;
  line-height: 20px;
}
.button-reason { font-size: 12px; line-height: 16px; color: var(--ink-muted); }

/* ---- Form fields (label 12 px on top, control 40 px / 44 px mobile, help or error below) */

.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field-label { font-size: 12px; line-height: 16px; font-weight: 700; color: var(--ink-muted); }
.form-field-help { font-size: 12px; line-height: 16px; color: var(--ink-muted); }
/* The errors of one field, together under the id its control points to (aria-describedby). */
.form-field-messages { display: flex; flex-direction: column; gap: 6px; }
.form-field-error { font-size: 12px; line-height: 16px; color: var(--danger); }
/* :where() keeps this rule weak, so component rules (code cells...) override it. */
.form-field :where(input:not([type="checkbox"], [type="radio"], [type="file"]), select, textarea) {
  width: 100%;
  height: var(--control-height);
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 24px;
}
.form-field textarea { height: auto; min-height: 88px; padding: 8px 12px; resize: vertical; }
.form-field--date input,
.form-field--money input { font-family: var(--font-mono); }
.form-field--error input,
.form-field--error select,
.form-field--error textarea { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger); }
/* The focus ring wins over the red one, or keyboard focus vanishes on the fields to fix. */
.form-field--error :is(input, select, textarea):focus-visible { box-shadow: var(--focus-ring); }
.form-field--readonly input { border-color: var(--line); background: var(--surface-sunken); }
.form-field--disabled { opacity: 0.5; }
.form-field--disabled input { background: var(--surface-sunken); cursor: not-allowed; }
.form-field-stack { display: flex; flex-direction: column; gap: var(--space-4); }

/* TOTP code: six cells of 52 px, the one in focus with a 2 px navy border. */
.code-cells { display: flex; gap: var(--space-2); }
.form-field .code-cell {
  flex: 1;
  min-width: 0;
  height: 52px;
  padding: 0;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 700;
}
.form-field .code-cell:focus { outline: none; border: 2px solid var(--navy-ink); box-shadow: none; }
.form-field--error .code-cell { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger); }

/* ---- App shell: 232 px sidebar in surface-sunken, main padded 24/32 px ------------------ */

.app-shell {
  display: flex;
  min-height: 100vh;
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  line-height: 20px;
}
.app-shell h1, .app-shell h2, .app-shell h3, .app-shell p { margin: 0; }
.app-main {
  flex: 1;
  min-width: 0;
  padding: 24px 32px 40px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.sidebar-nav {
  position: sticky;
  top: 0;
  flex: none;
  width: var(--sidebar-width);
  height: 100vh;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  background: var(--surface-sunken);
  border-right: 1px solid var(--line);
}
.sidebar-brand { display: flex; align-items: center; gap: 12px; font-size: 16px; line-height: 24px; font-weight: 700; color: var(--ink); text-decoration: none; }
.sidebar-brand:hover { color: var(--ink); }
.sidebar-nav nav { display: flex; flex-direction: column; gap: 16px; }
.sidebar-nav-group { display: flex; flex-direction: column; }
.sidebar-nav-label {
  padding: 0 12px 6px;
  font-size: 12px;
  line-height: 16px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-subtle);
}
/* 32 px items at 14 px (2026-09-29: at 40 px, Admin's eighteen items ran past a laptop's
   screen, Terminar sessão below it); the phone's drawer keeps its 44 px ones. */
.sidebar-nav-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  font-size: 14px;
  line-height: 20px;
  color: var(--ink-muted);
  text-decoration: none;
}
.sidebar-nav-item:hover { color: var(--ink); background: var(--surface); }
.sidebar-nav-item--current,
.sidebar-nav-item--current:hover { background: var(--navy-soft); color: var(--ink); }
/* The point: the current item's citrus dot. */
.sidebar-nav-point { flex: none; width: 8px; height: 8px; margin-top: 6px; border-radius: var(--radius-full); background: transparent; }
.sidebar-nav-item--current .sidebar-nav-point { background: var(--citrus); }
.sidebar-nav-name { flex: 1; min-width: 0; }
.sidebar-nav-external { flex: none; margin-top: 3px; }
/* The approvals missing beside Aprovações (G15.3, frame 20a). */
.sidebar-nav-count { flex: none; font-family: var(--font-mono); font-size: 12px; line-height: 20px; color: var(--ink-muted); }
.sidebar-nav-item--current .sidebar-nav-count { color: var(--ink); }
/* O meu espaço (frame 20c): an Admin's own pages under their name, folded unless one is open. */
.sidebar-mine { margin: 8px 0 4px; }
.sidebar-mine > summary { display: flex; align-items: center; gap: 8px; padding: 6px 0; list-style: none; cursor: pointer; font-size: 13px; line-height: 20px; font-weight: 700; color: var(--ink); }
.sidebar-mine > summary::-webkit-details-marker { display: none; }
.sidebar-mine > summary .icon { margin-left: auto; color: var(--ink-muted); }
.sidebar-mine[open] > summary .icon { transform: rotate(180deg); }
.sidebar-mine > summary:focus-visible { box-shadow: var(--focus-ring); outline: none; border-radius: var(--radius-sm); }
.sidebar-mine .sidebar-nav-item { font-size: 13px; padding-top: 4px; padding-bottom: 4px; }
.sidebar-user {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  line-height: 16px;
  color: var(--ink-muted);
}
.sidebar-user-name { display: block; font-size: 14px; line-height: 20px; color: var(--ink); overflow-wrap: anywhere; }
.sidebar-logout {
  display: block;
  margin-top: 8px;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.sidebar-logout:hover { color: var(--ink); }
/* Night mode's switch beside the name (static/js/theme.js): the moon by day, the sun at night.
   Without the script there is no night mode, so no switch either. */
.sidebar-user-row { display: flex; align-items: flex-start; gap: 8px; }
.sidebar-user-text { flex: 1; min-width: 0; }
.theme-toggle {
  flex: none;
  width: 32px;
  height: 32px;
  margin: -6px -8px 0 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: var(--radius-md);
  background: none;
  color: var(--ink-muted);
  cursor: pointer;
}
.theme-toggle:hover { color: var(--ink); background: var(--surface); }
html:not([data-theme]) .theme-toggle,
.theme-toggle-sun,
[data-theme="dark"] .theme-toggle-moon { display: none; }
[data-theme="dark"] .theme-toggle-sun { display: block; }

.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.page-header-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.page-eyebrow { font-size: 12px; line-height: 16px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-muted); }
.page-title-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-title { font-size: 28px; line-height: 34px; font-weight: 700; letter-spacing: -0.01em; }
.page-subtitle { max-width: 80ch; font-size: 12px; line-height: 16px; color: var(--ink-muted); text-wrap: pretty; }
.page-actions { display: flex; align-items: center; gap: 12px; flex: none; }
.page-actions form { margin: 0; }

.section-header { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.section-title { font-size: 16px; line-height: 24px; font-weight: 700; }
.section-meta { font-size: 12px; line-height: 16px; color: var(--ink-muted); }
/* Footnotes and subtitles are read, not scanned: lines of about 80 characters (they ran to 160). */
.footnote { padding-top: 10px; font-size: 12px; line-height: 16px; color: var(--ink-muted); text-wrap: pretty; max-width: 80ch; }

/* Mobile header and navigation drawer (390 px frames): mark left, 44 px menu right; the
   drawer slides in from the right, 304 px, over the dialogs' scrim. It opens by :target, so
   it works without JavaScript. */
.mobile-header { display: none; }
.mobile-drawer, .mobile-drawer-scrim { display: none; }
/* Phone widths only (767 px and less), where Definições is the Drive status alone: its tabs
   stay on a tablet or a zoomed laptop. */
.only-phone { display: none; }
@media (max-width: 767px) {
  .only-phone { display: initial; }
  /* Wins over a component's own display (the Definições tabs). */
  .not-phone { display: none !important; }
}

@media (max-width: 1023px) {
  .app-shell { flex-direction: column; }
  .app-shell > .sidebar-nav { display: none; }
  .mobile-header {
    position: sticky;
    top: 0;
    z-index: 10;
    height: 56px;
    flex: none;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 8px 0 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
  }
  .mobile-header .sidebar-brand { flex: 1; }
  .icon-button {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    color: var(--ink);
  }
  .icon-button:hover { color: var(--ink); background: var(--surface-sunken); }
  .app-main { padding: 20px 16px 32px; gap: 20px; }
  .page-header { flex-direction: column; }
  .page-title { font-size: 24px; line-height: 32px; }
  .page-actions { flex-wrap: wrap; }

  .mobile-drawer:target,
  .mobile-drawer.mobile-drawer--open { display: flex; }
  .mobile-drawer:target ~ .mobile-drawer-scrim,
  .mobile-drawer--open ~ .mobile-drawer-scrim { display: block; }
  .mobile-drawer-scrim { position: fixed; inset: 0; z-index: 20; background: var(--scrim); }
  .mobile-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 21;
    width: 304px;
    max-width: 100%;
    flex-direction: column;
    gap: 20px;
    padding: 0 16px 24px;
    overflow-y: auto;
    background: var(--surface);
    box-shadow: var(--drawer-shadow);
    animation: drawer-in var(--motion-panel);
  }
  .mobile-drawer-header { height: 56px; flex: none; display: flex; align-items: center; gap: 12px; margin-right: -8px; border-bottom: 1px solid var(--line); }
  .mobile-drawer-header .sidebar-brand { flex: 1; }
  .mobile-drawer nav { display: flex; flex-direction: column; gap: 16px; }
  .mobile-drawer .sidebar-nav-item { align-items: center; min-height: 44px; padding: 10px 12px; font-size: 16px; line-height: 24px; }
  .mobile-drawer .sidebar-nav-point,
  .mobile-drawer .sidebar-nav-external { margin-top: 0; }
  .mobile-drawer .sidebar-mine > summary { min-height: 44px; font-size: 16px; line-height: 24px; }
  .mobile-drawer .sidebar-logout { display: inline-flex; align-items: center; min-height: 44px; margin-top: 4px; font-size: 14px; line-height: 20px; }
  .mobile-drawer .theme-toggle { width: 44px; height: 44px; margin: -12px -8px 0 0; }
  .mobile-drawer .theme-toggle:hover { background: var(--surface-sunken); }
}
@keyframes drawer-in { from { transform: translateX(100%); } to { transform: none; } }

/* ---- Login: a 400 px card on surface-sunken; full width under a 56 px header on mobile -- */

.app-shell--login {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--surface-sunken);
}
.app-shell--login .mobile-header { display: none; }
.login-card {
  width: 400px;
  max-width: 100%;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  background: var(--surface-raised);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}
.login-card form { display: flex; flex-direction: column; gap: 24px; margin: 0; }
.login-brand { display: flex; align-items: center; gap: 12px; font-size: 20px; line-height: 28px; font-weight: 700; }
.login-heading { display: flex; flex-direction: column; gap: 4px; }
.login-heading h1 { font-size: 24px; line-height: 32px; font-weight: 700; text-wrap: pretty; }
.login-heading p { color: var(--ink-muted); text-wrap: pretty; }
.login-card .button--primary,
.login-card .button--secondary { width: 100%; }
.login-card .button--link { align-self: center; }
.login-who { padding: 10px 12px; border-radius: var(--radius-md); background: var(--surface-sunken); font-size: 12px; line-height: 16px; color: var(--ink-muted); overflow-wrap: anywhere; }
.login-who b { color: var(--ink); }
.login-foot { font-size: 12px; line-height: 16px; color: var(--ink-muted); text-align: center; text-wrap: pretty; }
.login-setup { display: flex; gap: 20px; align-items: flex-start; }
.login-setup-key { display: flex; flex-direction: column; gap: 8px; min-width: 0; font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.login-setup-key code { font-family: var(--font-mono); font-size: 13px; line-height: 20px; color: var(--ink); overflow-wrap: anywhere; }
.qr-code {
  flex: none;
  width: 152px;
  height: 152px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}
.qr-code svg { display: block; width: 100%; height: 100%; }

@media (max-width: 767px) {
  .app-shell--login { justify-content: flex-start; padding: 0; background: var(--surface); }
  .app-shell--login .mobile-header { display: flex; position: static; width: 100%; padding: 0 16px; }
  .app-shell--login .login-brand-card { display: none; }
  .login-card { width: 100%; padding: 24px 20px 32px; border-radius: 0; box-shadow: none; background: var(--surface); }
  .login-card .button:not(.button--link) { height: 44px; }
  .login-card .button--link { min-height: 44px; }
  .form-field :where(input:not([type="checkbox"], [type="radio"], [type="file"])) { height: 44px; }
  .form-field .code-cell { height: 52px; }
  .login-setup { flex-direction: column; align-items: center; gap: 16px; }
  .login-setup-key { gap: 4px; text-align: center; }
  .qr-code { width: 168px; height: 168px; }
}

/* ---- Status badge: 12 px bold on a soft tone; the lock follows the locked states -------- */

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  line-height: 16px;
  font-weight: 700;
  white-space: nowrap;
  color: var(--ink-muted);
  background: var(--surface-sunken);
}
.status-badge--submetida, .status-badge--correcao, .status-badge--recebida, .status-badge--pendente, .status-badge--por-pagar,
.status-badge--assinado { color: var(--navy-ink); background: var(--navy-soft); }
.status-badge--aprovada, .status-badge--enviado, .status-badge--ligado, .status-badge--ativo, .status-badge--lancada, .status-badge--ativa, .status-badge--fechado,
.status-badge--confirmado, .status-badge--real, .status-badge--paga-em-parte { color: var(--success); background: var(--success-soft); }
.status-badge--devolvida, .status-badge--desatualizada, .status-badge--por-faturar, .status-badge--contestada, .status-badge--diferenca, .status-badge--excede-um-limite, .status-badge--perto-do-limite,
.status-badge--termina-em-breve, .status-badge--limite-excedido, .status-badge--dias-depois-do-fim, .status-badge--mudou-depois-de-pago, .status-badge--por-confirmar,
.status-badge--acima-do-limite, .status-badge--devolvido, .status-badge--desatualizado, .status-badge--por-fechar, .status-badge--a-expirar { color: var(--warning); background: var(--warning-soft); }
.status-badge--disputada, .status-badge--rejeitada, .status-badge--falha, .status-badge--falhou, .status-badge--prazo-passado, .status-badge--expirado,
.status-badge--em-atraso { color: var(--danger); background: var(--danger-soft); }
/* What was read from an email (chapter 23): what can only be discarded is in danger. */
.status-badge--nao-corresponde, .status-badge--erro-de-leitura { color: var(--danger); background: var(--danger-soft); }
.status-badge--mes-ja-registado { color: var(--warning); background: var(--warning-soft); }
/* Paga, Reembolsada and a salary's Pago are filled so they differ from Aprovada; Substituído,
   Descartada, Por enviar, a month's Aberto, a payslip's Por registar and the forecast's Previsto
   are outlined, so they differ from Rascunho and Recebida. */
.status-badge--paga, .status-badge--reembolsada, .status-badge--pago { color: var(--on-status); background: var(--success); }
.status-badge--substituido, .status-badge--descartada, .status-badge--sem-dias, .status-badge--por-enviar, .status-badge--aberto, .status-badge--por-registar,
.status-badge--por-gerar, .status-badge--previsto, .status-badge--nao-configurado, .status-badge--descartado, .status-badge--anulada { padding: 1px 7px; color: var(--ink-muted); background: transparent; border: 1px solid var(--line-strong); }

/* ---- Month selector: 36 px, chevrons either side of the month --------------------------- */

.month-selector {
  display: inline-flex;
  align-items: center;
  height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
}
.month-selector-step {
  width: 36px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  border-radius: var(--radius-md);
}
.month-selector-step:hover { color: var(--ink); background: var(--surface-sunken); }
/* The first month, Mentzai's (settings.FIRST_MONTH): nothing before it to go to. */
.month-selector-step[aria-disabled="true"] { color: var(--ink-subtle); opacity: 0.5; cursor: not-allowed; }
.month-selector-step[aria-disabled="true"]:hover { background: none; }
.month-selector-label {
  min-width: 140px;
  padding: 0 8px;
  line-height: 34px;
  text-align: center;
  font-weight: 700;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
}
/* On a phone (mobile frames 2l, 3q): the whole width and 44 px tall, the arrows 44 px wide. */
@media (max-width: 767px) {
  .month-selector { display: flex; height: 44px; }
  .month-selector-step { width: 44px; height: 42px; }
  .month-selector-label { flex: 1; min-width: 0; line-height: 42px; }
}

/* ---- Day cell: 36 px, reason codes and P/R at the foot ---------------------------------- */

.day-cell {
  position: relative;
  min-width: 0;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 16px;
  font-weight: 700;
}
.day-cell-mark { position: absolute; bottom: 1px; left: 0; right: 0; text-align: center; font-size: 9px; line-height: 10px; font-weight: 700; }
.day-cell--worked { background: var(--navy); color: var(--ink-on-midnight); }
/* At night the navy day sits on midnight: a hairline keeps the month readable. */
[data-theme="dark"] .day-cell--worked { border: 1px solid var(--line-strong); }
.day-cell--worked-warning { background: var(--warning); color: var(--on-status); }
.day-cell--excluded { background: var(--surface); border: 1px dashed var(--warning); color: var(--warning); font-size: 10px; }
.day-cell--blocked { background: var(--danger); color: var(--on-status); }
.day-cell--admin { background: var(--surface); border: 1px solid var(--line-strong); color: var(--ink-muted); font-size: 9px; }
.day-cell--leave { background: var(--navy-soft); color: var(--navy-ink); font-size: 9px; }
/* Calendário da equipa (frame 4e): a request still to decide keeps its code, dashed. */
.day-cell--leave-pendente { background: var(--surface); border: 1px dashed var(--navy-ink); }
.day-cell--free { background: var(--surface); border: 1px solid var(--line); color: var(--ink); }
.day-cell--off { background: var(--surface-sunken); color: var(--ink-subtle); }
.day-cell--out { background: transparent; border: 1px dashed var(--line); color: var(--ink-subtle); }

/* ---- Warnings list: errors first; Erro filled red, Bloqueante soft red, Aviso soft amber - */

.warnings-list { display: flex; flex-direction: column; max-width: 900px; }
.warnings-list-header { display: flex; align-items: baseline; gap: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.warnings-list-item {
  display: grid;
  grid-template-columns: 96px 72px 1fr;
  gap: 12px;
  align-items: start;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.warnings-list-severity {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  line-height: 16px;
  font-weight: 700;
  white-space: nowrap;
}
.warnings-list-item--erro .warnings-list-severity { color: var(--on-status); background: var(--danger); }
.warnings-list-item--bloqueante .warnings-list-severity { color: var(--danger); background: var(--danger-soft); }
.warnings-list-item--aviso .warnings-list-severity { color: var(--warning); background: var(--warning-soft); }
.warnings-list-where { font-family: var(--font-mono); font-size: 13px; line-height: 20px; color: var(--ink-muted); }
.warnings-list-text { text-wrap: pretty; }
.warnings-list-item--action { grid-template-columns: 96px 72px minmax(0, 1fr) auto; }
.warnings-list-action { height: 20px; font-size: 14px; line-height: 20px; }
@media (max-width: 767px) {
  .warnings-list-item { grid-template-columns: auto 1fr; }
  .warnings-list-text { grid-column: 1 / -1; }
}

/* ---- Banners: locked-banner says who locked it and when; notice does not lock ----------- */

.locked-banner,
.notice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 16px;
  border-radius: var(--radius-md);
}
.locked-banner { background: var(--navy-soft); }
.notice--info { background: var(--surface-sunken); }
.notice--warning { background: var(--warning-soft); }
.notice--danger { background: var(--danger-soft); }
.notice--danger .banner-icon { color: var(--danger); }
.banner-icon { flex: none; margin-top: 2px; }
.banner-title { display: block; font-weight: 700; }
.banner-text { color: var(--ink-muted); text-wrap: pretty; }
/* A notice without a title (a dialog's warning: the question above is its title) reads in ink. */
.banner-text:first-child { color: var(--ink); }
/* Where the next step is done, under what the banner says. */
.banner-link { display: block; width: fit-content; margin-top: 4px; font-weight: 700; color: var(--link); }
.banner-links { display: flex; flex-wrap: wrap; column-gap: 20px; }
.login-card .notice { flex-direction: column; gap: 2px; }
/* On a phone the link is 44 px tall to the touch (mobile frames 3u, 11ai). */
@media (max-width: 767px) {
  .banner-link { display: flex; align-items: center; min-height: 44px; margin-top: 0; }
}

/* ---- Dropzone: PDF only; the active state while a file is dragged over ------------------ */

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 32px 24px;
  border: 2px dashed var(--line-strong);
  border-radius: var(--radius-md);
  text-align: center;
  cursor: pointer;
}
.dropzone-icon { color: var(--ink-muted); }
.dropzone-title { font-size: 16px; line-height: 24px; font-weight: 700; }
.dropzone-choose { color: var(--link); font-weight: 700; }
.dropzone:hover .dropzone-choose { text-decoration: underline; text-underline-offset: 2px; }
.dropzone-hint { font-size: 12px; line-height: 16px; color: var(--ink-muted); overflow-wrap: anywhere; }
.dropzone:focus-within { box-shadow: var(--focus-ring); }
/* A page's zone only: a dialog's (file-drop) takes the drag state on its field, styled below. */
.dropzone.dropzone--active { border: 2px solid var(--navy-ink); background: var(--navy-soft); }
.dropzone.dropzone--active .dropzone-icon { color: var(--navy-ink); }
.dropzone-active-text, .dropzone-file { display: none; }
.dropzone--active .dropzone-idle-text { display: none; }
.dropzone--active .dropzone-active-text { display: block; }
.dropzone--has-file .dropzone-file { display: block; }
.dropzone--has-file .dropzone-hint-default { display: none; }
/* Sent as soon as the file is there (Carregar timesheet): it says so while the page loads. */
.dropzone-busy-text { display: none; }
form[aria-busy="true"] [data-dropzone-autosubmit] .dropzone-idle-text,
form[aria-busy="true"] [data-dropzone-autosubmit] .dropzone-button { display: none; }
form[aria-busy="true"] [data-dropzone-autosubmit] .dropzone-busy-text { display: block; }

/* ---- Confirmation dialog: 520 px over the scrim; Cancelar left of the action ------------ */

.confirm-dialog {
  width: 520px;
  max-width: calc(100vw - 32px);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-md);
  font-size: 14px;
  line-height: 20px;
  /* A dialog opened from a table's action cell must not take on its alignment. */
  text-align: left;
  white-space: normal;
}
.confirm-dialog::backdrop { background: var(--scrim); }
.confirm-dialog form { display: flex; flex-direction: column; gap: 20px; margin: 0; }
.confirm-dialog h3 { margin: 0 0 8px; font-size: 20px; line-height: 28px; font-weight: 700; text-wrap: pretty; }
.confirm-dialog p { margin: 0; color: var(--ink-muted); text-wrap: pretty; }
.confirm-dialog-actions { display: flex; justify-content: flex-end; gap: 12px; }
/* The required note blocks the action until it is filled. */
.confirm-dialog--note:has(textarea:invalid) .confirm-dialog-actions :is(.button--primary, .button--destructive) { opacity: 0.5; pointer-events: none; }

/* ---- Empty state explains and offers no actions; toast is midnight, bottom centre, 4 s --- */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 40px 24px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  text-align: center;
}
.empty-state-title { font-size: 16px; line-height: 24px; font-weight: 700; }
.empty-state-text { color: var(--ink-muted); text-wrap: pretty; }
.empty-state--measure .empty-state-text { max-width: 520px; }
.empty-state--page { padding: 56px 24px; }
.empty-state .empty-state-action { margin-top: 12px; }
@media (max-width: 767px) { .empty-state { padding: 32px 20px; } }

.toast-region {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 30;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  background: var(--midnight);
  color: var(--ink-on-midnight);
  box-shadow: var(--shadow-md);
  max-width: calc(100vw - 32px);
  font-size: 14px;
  line-height: 20px;
  text-wrap: pretty;
  pointer-events: auto;
  animation: toast-out 250ms ease-in 8s forwards;
}
/* At night the page is midnight already: the toast rises on the raised surface instead. */
[data-theme="dark"] .toast { background: var(--surface-raised); color: var(--ink); box-shadow: var(--shadow-lg); }
/* Kept while the pointer rests on it, to finish reading. */
.toast:hover { animation-play-state: paused; }
@keyframes toast-out { to { opacity: 0; visibility: hidden; } }
@media (prefers-reduced-motion: reduce) { .toast { animation-duration: 0ms; } }
/* On a phone a toast takes the width, 16 px from each side (mobile frames 11ad, 11af). */
@media (max-width: 767px) {
  .toast-region { right: 16px; left: 16px; align-items: stretch; transform: none; }
  .toast { align-items: flex-start; }
  .toast .icon { margin-top: 1px; }
}

/* ---- Data table: thin rules, mono numbers on the right, the verb in the last column ----- */

.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  padding: 0 16px 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  line-height: 16px;
  font-weight: 700;
  color: var(--ink-muted);
  text-align: left;
}
.data-table td { padding: 12px 16px 12px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table th:last-child, .data-table td:last-child { padding-right: 0; }
.data-table .num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; text-align: right; }
.data-table .mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.data-table .file { font-family: var(--font-mono); font-size: 13px; line-height: 20px; overflow-wrap: anywhere; }
.data-table .actions { text-align: right; white-space: nowrap; }
.data-table-sub { display: block; font-size: 12px; line-height: 16px; color: var(--ink-muted); }
@media (max-width: 767px) {
  .data-table--stacked thead { display: none; }
  .data-table--stacked, .data-table--stacked tbody { display: block; border-top: 1px solid var(--line); }
  .data-table--stacked tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
  }
  .data-table--stacked td { padding: 0; border: 0; font-size: 12px; line-height: 16px; color: var(--ink-muted); text-align: left; }
  .data-table--stacked td:first-child { grid-column: 1 / -1; font-size: 13px; line-height: 20px; color: var(--ink); }
  .data-table--stacked td[data-label] { font-family: var(--font-sans); text-align: left; }
  .data-table--stacked td[data-label]::before { content: attr(data-label) " "; }
  .data-table--stacked td[data-label] span { font-family: var(--font-mono); color: var(--ink); }
  .data-table--stacked td.wide { grid-column: 1 / -1; }
  .data-table--stacked .button--link { display: inline-flex; align-items: center; min-height: 44px; }
}
/* data-table--cards: on a phone each row is one of the frames' cards (mobile frames 9u, 11z): no
   head, the cells without their rules, a fact's name above it (data-label), and the row's links
   44 px tall. Each table lays out its cards (Despesas, Deslocações). */
@media (max-width: 767px) {
  .data-table--cards, .data-table--cards tbody { display: block; }
  .data-table--cards { border-top: 1px solid var(--line); }
  .data-table--cards thead { display: none; }
  .data-table--cards td { min-width: 0; padding: 0; border: 0; text-align: left; overflow-wrap: anywhere; }
  .data-table--cards td.num { text-align: left; }
  .data-table--cards td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-family: var(--font-sans);
    font-size: 12px;
    line-height: 16px;
    font-weight: 400;
    color: var(--ink-muted);
  }
  .data-table--cards .actions { text-align: left; white-space: normal; }
  .data-table--cards .table-actions { justify-content: flex-start; gap: 0 24px; }
  .data-table--cards .button--link { display: inline-flex; align-items: center; min-height: 44px; }
}
/* table-scroll: a table drawn for the desktop frames (1440 px), on any narrower screen (a laptop,
   a tablet, a phone turned sideways or held upright), scrolls sideways instead of squeezing its
   columns until their texts overlap, as Admin's grids do (G4.6): each column as wide as its content
   needs, the table the page's width at least. On a phone held upright the employee's and the
   freelancer's tables are cards or stack their rows in it. Relative, so the screen reader's texts
   (visually-hidden) scroll with the table, not the page. */
@media (max-width: 1439px) {
  .table-scroll { position: relative; overflow-x: auto; }
  .table-scroll > .data-table { width: auto; min-width: 100%; table-layout: auto; }
}

/* ---- Definições: the three-column status strip (no class in the artboard) --------------- */

.status-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px 24px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.status-strip > div { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.status-strip-label { font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.status-strip-value { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.status-strip-file { font-family: var(--font-mono); font-size: 13px; line-height: 20px; color: var(--ink-muted); overflow-wrap: anywhere; }
.status-strip-note { font-size: 12px; line-height: 16px; color: var(--ink-muted); text-wrap: pretty; }
.status-strip-count { font-family: var(--font-mono); font-size: 24px; line-height: 32px; font-weight: 700; font-variant-numeric: tabular-nums; }
@media (max-width: 767px) { .status-strip { grid-template-columns: 1fr; } }

/* ---- Dados mestre (Definições, Admin, desktop): tabs, list toolbar, detail and form pages - */

/* Pages whose frames space their parts 20 px apart. */
.app-main--tight { gap: 20px; }
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  align-self: flex-start;
  font-weight: 700;
  color: var(--link);
  text-decoration: none;
}
.back-link:hover { color: var(--link); text-decoration: underline; text-underline-offset: 2px; }
@media (max-width: 767px) { .back-link { min-height: 44px; } } /* mobile frames 2r to 2t */

.tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--line); }
.tabs-item {
  padding: 8px 0 10px;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  color: var(--ink-muted);
  text-decoration: none;
  white-space: nowrap;
}
.tabs-item:hover { color: var(--ink); }
.tabs-item--current,
.tabs-item--current:hover { font-weight: 700; color: var(--ink); border-bottom-color: var(--ink); }

/* The list toolbar: search, filter chips, and the create button on the right. */
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0; }
.toolbar-end { margin-left: auto; display: flex; align-items: center; gap: 12px; }
/* A phone stacks the toolbar's controls, each the whole width (mobile frames 2l, 3q). */
@media (max-width: 767px) {
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar .toolbar-select select { width: 100%; height: 44px; }
}
.toolbar .button:not(.button--link),
.form-actions .button:not(.button--link) { height: var(--control-height-dense); font-size: 14px; line-height: 20px; }
.form-field--search {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  width: 320px;
  max-width: 100%;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink-muted);
}
.form-field--search:focus-within { box-shadow: var(--focus-ring); }
.form-field--search input {
  flex: 1;
  min-width: 0;
  height: 34px;
  padding: 0;
  border: 0;
  outline: none;
  appearance: none;
  background: transparent;
  color: var(--ink);
  font: inherit;
}
.form-field--search input::placeholder { color: var(--ink-subtle); }
.filter-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-chip {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-full);
  font-size: 12px;
  line-height: 16px;
  font-weight: 700;
  color: var(--ink-muted);
  text-decoration: none;
}
.filter-chip:hover { color: var(--ink); }
.filter-chip--empty { border-color: var(--line); color: var(--ink-subtle); }
.filter-chip--current,
.filter-chip--current:hover { background: var(--navy-soft); border-color: transparent; color: var(--ink); }

/* Detail and form pages: sections 32 px apart; forms 880 px wide. */
.page-sections { display: flex; flex-direction: column; gap: 32px; min-width: 0; margin: 0; }
.page-sections--form { max-width: 880px; }
.section-heading { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; min-width: 0; }
.section-header--table { align-items: center; min-height: 36px; margin-bottom: 8px; }

/* Key and value facts in three columns between two rules (Dados, Contrato). */
.kv-section { display: flex; flex-direction: column; gap: 12px; }
.kv-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px 24px;
  margin: 0;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.kv-item { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; }
.kv-item dt { font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.kv-item dd { margin: 0; overflow-wrap: anywhere; }
.kv-lines { white-space: pre-line; }
.kv-item .kv-sub { font-size: 12px; line-height: 16px; color: var(--ink-muted); text-wrap: pretty; }
.kv-item .kv-warn { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; line-height: 16px; font-weight: 700; color: var(--warning); }
/* The order's limits (G3.5): four columns, as frames mf and 3ac draw them. */
.kv-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
/* A history, a line each (Fecho do mês, frame 9n). */
.kv-grid--1 { grid-template-columns: minmax(0, 1fr); gap: 8px; }
/* Dias do contrato (no frame): the contract's days as a 12 px bar on a navy-soft track, one
   navy ramp for what is counted and citrus for this timesheet, 2 px of surface between parts;
   each part takes 24 px to hover. Past the limit, an ink mark shows where it is. */
.days-meter { display: flex; flex-direction: column; gap: 8px; }
.days-meter-figures { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin: 0; }
.days-meter-status { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; line-height: 16px; font-weight: 700; color: var(--warning); }
.days-meter-bar { position: relative; display: flex; gap: 2px; max-width: 900px; }
.days-meter-part { flex: 0 1 auto; min-width: 2px; padding: 6px 0; }
.days-meter-part::before { content: ""; display: block; height: 12px; background: var(--meter-fill); }
.days-meter-part:first-child::before { border-radius: 4px 0 0 4px; }
.days-meter-part:last-of-type::before { border-radius: 0 4px 4px 0; }
.days-meter-part:first-child:last-of-type::before { border-radius: 4px; }
.days-meter-part--sent, .days-meter-key--sent { --meter-fill: var(--navy-ink); }
.days-meter-part--waiting, .days-meter-key--waiting { --meter-fill: var(--line-strong); }
.days-meter-part--this, .days-meter-key--this { --meter-fill: var(--citrus); }
.days-meter-part--left, .days-meter-key--left { --meter-fill: var(--navy-soft); }
.days-meter-limit { position: absolute; top: 2px; bottom: 2px; width: 2px; margin-left: -1px; border-radius: 1px; background: var(--ink); }
.days-meter-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0; padding: 0; list-style: none; font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.days-meter-legend li { display: inline-flex; align-items: center; gap: 6px; }
.days-meter-legend b { color: var(--ink); }
.days-meter-key { width: 10px; height: 10px; border-radius: 2px; background: var(--meter-fill); }
.days-meter-key--left { box-shadow: inset 0 0 0 1px var(--line); }
.kv-section .days-meter-bar { margin-top: 4px; }

/* Forms: two columns; controls 40 px with 14 px text; a chevron, a calendar or a suffix
   inside the box; errors and confirmations bold, with their icon. */
.form-section { display: flex; flex-direction: column; gap: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 24px; align-items: start; }
.form-field--wide { grid-column: 1 / -1; }
.form-grid .form-field :where(input:not([type="checkbox"], [type="radio"]), select, textarea) { font-size: 14px; line-height: 20px; }
.form-grid textarea { min-height: 64px; }
.form-field--mono input { font-family: var(--font-mono); }
.form-control { position: relative; display: flex; align-items: center; }
.form-control-icon,
.form-control-suffix { position: absolute; right: 12px; color: var(--ink-muted); pointer-events: none; }
.form-control select { appearance: none; padding-right: 36px; }
.form-field--date input { padding-right: 36px; }
/* A date is typed as dd/mm/yyyy or picked in the calendar its button opens (static/js/app.js). */
.form-control-button {
  position: absolute;
  right: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
}
.form-control-button:hover { color: var(--ink); background: var(--surface-sunken); }
.date-picker {
  position: fixed;
  z-index: 40;
  width: 264px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  box-shadow: var(--shadow-lg);
  color: var(--ink);
  font: 400 13px/16px var(--font-sans);
  text-align: center;
}
.date-picker-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.date-picker-title { font-size: 14px; line-height: 20px; font-weight: 700; }
.date-picker-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.date-picker-weekday { padding: 4px 0; font-size: 11px; font-weight: 700; color: var(--ink-muted); }
.date-picker-step,
.date-picker-day {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: inherit;
  font: inherit;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.date-picker-step { width: 32px; font-size: 18px; color: var(--ink-muted); }
.date-picker-step:hover,
.date-picker-day:hover { background: var(--surface-sunken); color: var(--ink); }
.date-picker-day--today { box-shadow: inset 0 0 0 1px var(--line-strong); }
.date-picker-day--chosen,
.date-picker-day--chosen:hover { background: var(--navy-ink); color: var(--on-status); font-weight: 700; }
.date-picker-day:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.form-control:has(.form-control-suffix) input { padding-right: 56px; }
.form-control input[type="number"] { appearance: textfield; }
.form-control input[type="number"]::-webkit-inner-spin-button { appearance: none; margin: 0; }
.form-field-message { display: flex; align-items: flex-start; gap: 6px; font-size: 12px; line-height: 16px; font-weight: 700; }
.form-field-message .icon { margin-top: 1px; }
.form-field-message--error { color: var(--danger); }
.form-field-message--valid { color: var(--success); }
.app-shell input[type="checkbox"] { flex: none; width: 18px; height: 18px; margin: 0; accent-color: var(--navy-ink); }
.checkbox { display: inline-flex; align-items: center; gap: 10px; min-height: 40px; font-weight: 700; cursor: pointer; }

/* The VAT treatment: one card per treatment side by side, the chosen one with a 2 px navy
   border. */
fieldset.form-field { min-width: 0; margin: 0; padding: 0; border: 0; }
fieldset.form-field > legend { padding: 0; margin-bottom: 6px; }
.radio-cards { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 12px; }
.radio-card {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  cursor: pointer;
}
.radio-card:has(input:checked) { padding: 11px 13px; border: 2px solid var(--navy-ink); background: var(--navy-soft); }
.radio-card input, .radio-option input {
  appearance: none;
  flex: none;
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-full);
  background: var(--surface);
}
.radio-card input:checked, .radio-option input:checked { border: 5px solid var(--navy-ink); }
.radio-card input:focus-visible, .radio-option input:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.radio-card-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.radio-card-text span { font-size: 12px; line-height: 16px; color: var(--ink-muted); text-wrap: pretty; }

/* The save bar: what went wrong on the left, Cancelar and the save button on the right. */
.form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding-top: 16px; border-top: 1px solid var(--line); }
.form-actions-note { margin-right: auto; font-size: 12px; line-height: 16px; color: var(--ink-muted); }
/* Apagar at the left of an Editar page's buttons (G11.1), what went wrong beside it. */
.form-actions-aside { margin-right: auto; }
.form-actions-aside:has(+ .form-actions-note) { margin-right: 0; }

/* Tables of the Dados mestre frames: fixed columns, codes in 13 px mono. */
.data-table--fixed { table-layout: fixed; }
.code { font-family: var(--font-mono); font-size: 13px; line-height: 20px; }
.data-table-sub--warning { font-weight: 700; color: var(--warning); }

@media (max-width: 767px) {
  .kv-grid, .kv-grid--4, .form-grid { grid-template-columns: 1fr; }
  .radio-cards { grid-auto-flow: row; }
  .form-field--search { width: 100%; }
  .toolbar-end { margin-left: 0; }
  .form-field :where(select) { height: 44px; } /* as tall as the other fields */
}
/* iOS Safari zooms into a field whose text is under 16 px as it takes the focus, and stays zoomed:
   on a phone, and on any screen worked by touch (a phone turned sideways), the fields write 16 px
   (the mobile frames draw 14 px). */
@media (max-width: 767px), (pointer: coarse) {
  .form-grid .form-field :where(input:not([type="checkbox"], [type="radio"], [type="file"]), select, textarea),
  .form-field--search input { font-size: 16px; line-height: 24px; }
}

/* ---- Documentos (frames 2j, 2y, 2z): documents by year, the profile beside its form ---- */

.documents-table thead th { border-bottom: 0; }
.documents-table td { padding-top: 10px; padding-bottom: 10px; }
.documents-year > th {
  padding: 8px 0;
  border-bottom: 1px solid var(--line-strong);
  font-size: 12px;
  line-height: 16px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
tbody + tbody > .documents-year > th { padding-top: 24px; }
.documents-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.button--link-danger,
.button--link-danger:hover { color: var(--danger); }
/* A removal stands a little apart from the row's other actions, last in the row. */
.table-actions .button--link-danger:not(:first-child) { margin-left: 8px; }
.split-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 40px; align-items: start; }
.form-card { display: flex; flex-direction: column; gap: 16px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius-md); }
.form-card-form { display: flex; flex-direction: column; gap: 16px; margin: 0; }
.form-card-actions { display: flex; justify-content: flex-end; }
.form-card-actions .button { height: var(--control-height-dense); font-size: 14px; line-height: 20px; }

/* form-field--file: the chosen file's name in a box, "Escolher" beside it. */
.file-field { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.file-field-name {
  flex: 1;
  min-width: 0;
  min-height: var(--control-height);
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink-subtle);
  overflow-wrap: anywhere;
}
.file-field--chosen .file-field-name { font-family: var(--font-mono); font-size: 13px; line-height: 20px; color: var(--ink); }
.file-field .button { height: var(--control-height-dense); font-size: 14px; line-height: 20px; }
.file-field:focus-within .file-field-name { box-shadow: var(--focus-ring); }
.form-field--error .file-field-name { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger); }

/* On mobile (frame 2u) a document is a block: month and date, type, file, Descarregar. */
@media (max-width: 767px) {
  .split-layout { grid-template-columns: 1fr; gap: 24px; }
  .documents-table thead { display: none; }
  .documents-table, .documents-table tbody, .documents-year, .documents-year > th { display: block; }
  .documents-table tbody > tr:not(.documents-year) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 2px 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
  }
  .documents-table td { padding: 0; border: 0; }
  .documents-table .documents-month { grid-column: 1; grid-row: 1; }
  .documents-table .documents-since { grid-column: 2; grid-row: 1; font-size: 12px; line-height: 16px; color: var(--ink-muted); }
  .documents-table .documents-type,
  .documents-table .documents-file,
  .documents-table .documents-action { grid-column: 1 / -1; text-align: left; }
  .documents-table .documents-file .file { color: var(--ink-muted); }
  .documents-table .documents-size { display: none; }
  .documents-table .documents-actions { flex-direction: row; justify-content: flex-start; gap: 24px; }
  .documents-table .documents-action .button--link { display: inline-flex; align-items: center; min-height: 44px; }
}

/* ---- Pessoas, assignments and Feriados (frames mg to mo) -------------------------------- */

/* The segmented choice (Interno / Freelancer, Carnaval / Municipal): options side by side. */
.segmented { display: flex; gap: 8px; }
.segmented-option {
  position: relative;
  flex: 1 1 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--control-height);
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink-muted);
  cursor: pointer;
}
.segmented-option input { position: absolute; opacity: 0; pointer-events: none; }
.segmented-option:has(input:checked) { border-color: var(--navy-ink); background: var(--navy-soft); color: var(--ink); font-weight: 700; }
.segmented-option:has(input:focus-visible) { box-shadow: var(--focus-ring); }
.form-field--error .segmented-option { border-color: var(--danger); }
@media (max-width: 767px) { .segmented-option { min-height: 44px; } } /* mobile frame 11aa */

.form-grid-cell { display: flex; flex-direction: column; min-width: 0; }

/* A page beside its side cards (Férias e ausências' saldo, frame 4a). */
.split-layout--narrow { grid-template-columns: minmax(0, 1fr) 340px; }
/* Below 1200 px the tables need the whole width: the side column goes under them. */
@media (max-width: 1199px) { .split-layout, .split-layout--narrow { grid-template-columns: minmax(0, 1fr); } }
.side-cards { display: flex; flex-direction: column; gap: 16px; }
.side-card-header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.side-card-items { display: flex; flex-direction: column; gap: 12px; margin: 0; }
.side-card-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.side-card-buttons form { margin: 0; }
.side-card-buttons .button { height: var(--control-height-dense); font-size: 14px; line-height: 20px; }
.side-card-note { margin: 0; font-size: 12px; line-height: 16px; color: var(--ink-muted); text-wrap: pretty; }

/* A person's page in sections (G13.1): the side index (frame 17b), one section open beside it,
   with the citrus point on the open one; Resumo's cards (frame 17c); the Dados and Acesso cards
   side by side in Dados e acesso (not drawn as a section). The index is 8 px wider than the
   frame's 216, so that "Vínculos e atribuições" stays on one line in bold, when open. */
.hub-rail-layout { display: grid; grid-template-columns: 224px minmax(0, 1fr); gap: 32px; align-items: start; }
.hub-rail { display: flex; flex-direction: column; gap: 2px; padding: 8px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-sunken); position: sticky; top: 24px; }
.hub-rail a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--ink); text-decoration: none; font-size: 14px; line-height: 20px; }
.hub-rail a:hover { background: var(--surface); }
.hub-rail a:focus-visible { box-shadow: var(--focus-ring); outline: none; }
.hub-rail a .hub-rail-point { flex: none; width: 8px; height: 8px; border-radius: var(--radius-full); background: transparent; }
.hub-rail a[aria-current] { background: var(--navy-soft); font-weight: 700; }
.hub-rail a[aria-current] .hub-rail-point { background: var(--citrus); }
.hub-rail a .hub-rail-count { margin-left: auto; font-family: var(--font-mono); font-size: 12px; color: var(--ink-muted); }
.hub-rail-sep { height: 1px; margin: 6px 4px; background: var(--line); }
.hub-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.hub-card { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); }
.hub-card-label { font-size: 12px; line-height: 16px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-muted); }
.hub-card-value { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 16px; line-height: 24px; font-weight: 700; }
.hub-card-sub { color: var(--ink-muted); }
.hub-card-link { margin-top: auto; padding-top: 6px; font-weight: 700; color: var(--link); text-decoration: none; }
/* Registar ausência (G13.4, frame 17d): the working days, the saldo now and after, under the
   dialog's note. */
.dialog-side-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 12px 14px; border-radius: var(--radius-md); background: var(--surface-sunken); }
.dialog-side-facts b { display: block; font-family: var(--font-mono); font-size: 16px; line-height: 24px; }

/* A person's name in Admin's lists, leading to their page (G13.3, frame 17f). */
.person-link { color: var(--ink); font-weight: 700; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.person-link:hover { text-decoration-color: currentColor; }
.hub-data-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
/* Desktop only (G13.1); narrower, the index goes above the section and the cards stack. */
@media (max-width: 1023px) {
  .hub-rail-layout { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .hub-rail { position: static; }
  .hub-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 767px) { .hub-cards, .hub-data-cards { grid-template-columns: minmax(0, 1fr); } }
.status-badge--atual, .status-badge--convidado { color: var(--navy-ink); background: var(--navy-soft); }
.status-badge--sem-acesso { padding: 1px 7px; color: var(--ink-muted); background: transparent; border: 1px solid var(--line-strong); }

/* Dialogs with a form or the one-time link (frames mq, mm, mo, mi). */
.confirm-dialog--wide { width: 560px; }
.confirm-dialog-body { display: flex; flex-direction: column; gap: 20px; }
.dialog-note, .dialog-meta { margin: 0; font-size: 12px; line-height: 16px; color: var(--ink-muted); text-wrap: pretty; }
/* Pedir ausência: why the dates asked would be refused, as the dialog's note says it. */
.confirm-dialog .dialog-note--error { font-weight: 700; color: var(--danger); }
.dialog-note:empty { display: none; }
.dialog-meta { font-variant-numeric: tabular-nums; }
/* On a phone every dialog is a bottom sheet (mobile frames 2m, 9v, 11aa, 11ae): the whole width,
   rounded on top, its buttons stacked, 44 px, the action first. dialog.confirm-dialog, so that the
   wider dialogs' widths, set further down (Carregar despesa, Registar deslocação), give way. */
@media (max-width: 767px) {
  dialog.confirm-dialog {
    width: 100%;
    max-width: 100%;
    max-height: calc(100dvh - 48px);
    margin: auto 0 0;
    padding: 20px 16px calc(24px + env(safe-area-inset-bottom));
    border-width: 1px 0 0;
    border-radius: 12px 12px 0 0;
    overflow-y: auto;
    overscroll-behavior: contain; /* scrolled to its end, the sheet leaves the page behind put */
  }
  .confirm-dialog-actions { flex-direction: column-reverse; gap: 8px; }
  .confirm-dialog .confirm-dialog-actions .button:not(.button--link) { width: 100%; height: 44px; }
}
.link-box { display: flex; gap: 8px; align-items: center; }
.link-box-url {
  flex: 1;
  min-width: 0;
  min-height: var(--control-height);
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  color: var(--ink);
  font: 13px/20px var(--font-mono);
}
.link-box .button { height: var(--control-height-dense); font-size: 14px; line-height: 20px; }

/* Feriados: the year's select and the note in the toolbar (frame mn), a row's two links. */
.toolbar form { margin: 0; }
.toolbar-select select { width: 120px; }
.toolbar-note { font-size: 12px; line-height: 16px; color: var(--ink-muted); }
/* A card per holiday calendar, the one shown marked as the side index marks its section
   (G16.1, frame 21a). */
.calendar-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.calendar-card { color: var(--ink); text-decoration: none; }
.calendar-card:hover { border-color: var(--line-strong); }
.calendar-card--current { background: var(--navy-soft); border-color: var(--navy-soft); }
.calendar-card--current .hub-card-label::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: var(--radius-full); background: var(--citrus); vertical-align: 1px; }
/* A row's links wrap to a second line rather than widen their column (Remover, on a received
   invoice). */
.table-actions { display: inline-flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 16px; }
/* On a phone, every table's verbs, a section's link, the page's buttons, the tabs and a
   date's calendar button are 44 px to the touch, as stacked and card tables already were;
   a chip keeps its look, an invisible margin around it taking the touch. The two controls
   still under 16 px grow to it, so iOS does not zoom when they are touched. */
@media (max-width: 767px) {
  .data-table .actions .button--link,
  .section-header--table .button--link { display: inline-flex; align-items: center; min-height: 44px; }
  .page-header .button:not(.button--link),
  .toolbar .button:not(.button--link),
  .form-actions .button:not(.button--link) { height: 44px; }
  .tabs-item { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding-top: 0; padding-bottom: 0; }
  .filter-chips { row-gap: 16px; }
  .filter-chip { position: relative; }
  .filter-chip::after { content: ""; position: absolute; inset: -8px 0; }
  .form-control-button { right: 0; width: 44px; height: 44px; }
  .form-field--date input { padding-right: 44px; }
  .toolbar .timesheet-contract select { font-size: 16px; }
  .entitlements-table .form-field input { height: 44px; font-size: 16px; }
}

/* Aprovações (G15.3, frames 20a and 20m): a card per kind, one with nothing waiting quiet, and
   the line naming what waits in the other places; a phone leaves out when the oldest arrived. */
.hub-card--quiet .hub-card-value { color: var(--ink-muted); font-weight: 400; }
.place-elsewhere { margin: 0; color: var(--ink-muted); text-wrap: pretty; }
.place-elsewhere a { font-weight: 700; color: var(--link); text-decoration: none; }
.place-elsewhere a:hover { text-decoration: underline; }
@media (max-width: 767px) { .approvals-since { display: none; } }
/* Colaboradores (G15.4, frame 20d): a place's own page has no eyebrow above its title. */
.page-eyebrow:empty { display: none; }
/* Clientes and Contratos (G15.5, frames 20f to 20i): a card's reference keeps the card's size in
   the mono face, and is never broken at its hyphens. */
.hub-card .person-link { font-size: 16px; line-height: 24px; }
.hub-card .code { white-space: nowrap; }
/* Finanças and Empresa (G15.6, frames 20j, 20l and 20n): Finanças' nine cards in three rows of
   three since Faturas a clientes (G20.1, frame 24a), as every page of cards, and one a row on a
   phone, which leaves out the heading over them and what a card names besides what waits;
   Definições' line links Administração Django. */
.hub-card-sub a { font-weight: 700; color: var(--link); text-decoration: none; }
.hub-card-sub a:hover { text-decoration: underline; }
@media (max-width: 767px) {
  .finances-heading, .hub-card-more { display: none; }
}

/* Férias e ausências in Gestão (frames 4d, 4l): a saldo below zero in the warning tone; the
   person's note under the request's dates. */
.leave-requests-negative { font-weight: 700; color: var(--warning); }
.leave-requests-note { overflow-wrap: anywhere; }

/* Direitos a férias (frame mj): the year edited in place on surface-sunken, 8 px wider than
   the table on each side, with 36 px controls; what a refused save says in a row below. */
.entitlements-row--editing > td { padding-top: 8px; padding-bottom: 8px; background: var(--surface-sunken); vertical-align: top; }
.entitlements-row--editing > td:first-child { box-shadow: -8px 0 0 var(--surface-sunken); }
.entitlements-row--editing > td:last-child { box-shadow: 8px 0 0 var(--surface-sunken); }
.entitlements-row--editing:has(+ .entitlements-row--errors) > td { border-bottom: 0; }
.entitlements-row--errors > td { padding-top: 0; box-shadow: -8px 0 0 var(--surface-sunken), 8px 0 0 var(--surface-sunken); }
.entitlements-row--errors .form-field-message + .form-field-message { margin-top: 4px; }
.entitlements-cell { display: flex; align-items: center; min-height: var(--control-height-dense); }
.entitlements-cell--end { justify-content: flex-end; }
.entitlements-table .form-field :where(input) { height: var(--control-height-dense); padding: 0 10px; font-size: 14px; line-height: 20px; }
.entitlements-table input[type="number"] { appearance: textfield; }
.entitlements-table input[type="number"]::-webkit-inner-spin-button { appearance: none; margin: 0; }

/* ---- Timesheet (frames 2a to 2f, 2h, 3a, 3e): a row per assignment, a column per day --- */

.timesheet-contract select { width: auto; height: 36px; font-family: var(--font-mono); font-size: 13px; line-height: 20px; }
.timesheet-days, .timesheet-form { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.timesheet-form { margin: 0; }
/* Narrower than the frames, the grid scrolls sideways; the phone's calendar comes in G4.6.
   Relative, so the screen reader's words (visually-hidden) scroll with it too. */
.timesheet-scroll { position: relative; overflow-x: auto; }
.timesheet-grid { display: flex; flex-direction: column; gap: 2px; min-width: 960px; }
.timesheet-grid-row {
  display: grid;
  grid-template-columns: 236px repeat(var(--days), minmax(0, 1fr)) 44px;
  gap: 2px;
  align-items: stretch;
}
.timesheet-grid-day { display: flex; flex-direction: column; align-items: center; padding-bottom: 4px; }
.timesheet-grid-weekday { font-size: 10px; line-height: 12px; color: var(--ink-subtle); }
.timesheet-grid-day--holiday .timesheet-grid-weekday,
.timesheet-grid-day--closed .timesheet-grid-weekday { font-weight: 700; color: var(--ink); }
.timesheet-grid-date { font-family: var(--font-mono); font-size: 11px; line-height: 16px; color: var(--ink-muted); }
.timesheet-grid-day--off .timesheet-grid-date { color: var(--ink-subtle); }
.timesheet-grid-label { display: flex; flex-direction: column; justify-content: center; min-width: 0; padding-right: 12px; }
.timesheet-grid-code { font-family: var(--font-mono); font-size: 13px; line-height: 16px; }
.timesheet-grid-sub { font-size: 12px; line-height: 16px; color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timesheet-grid-total { position: relative; display: flex; align-items: center; justify-content: flex-end; font-family: var(--font-mono); font-weight: 700; }
/* The total's words for screen readers stay inside its cell, or the grid scrolls by 1 px. */
.timesheet-grid-total .visually-hidden { right: 0; margin: 0; }
.timesheet-grid-head .timesheet-grid-total { align-items: flex-end; padding-bottom: 4px; font-family: var(--font-sans); font-size: 10px; line-height: 12px; font-weight: 400; color: var(--ink-subtle); }
.timesheet-grid .day-cell-mark { font-size: 8px; line-height: 8px; }
/* A day the person can change is a button; :where() leaves the cell kinds their borders. */
:where(button.day-cell) { margin: 0; padding: 0; border: 0; font: inherit; cursor: pointer; }
button.day-cell:hover { outline: 1px solid var(--navy-ink); outline-offset: -1px; }
[data-timesheet-days][aria-busy="true"] button.day-cell { cursor: progress; }
.timesheet-foot { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.day-cell-legend { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.day-cell-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.day-cell-legend .day-cell { width: 24px; height: 20px; font-size: 8px; line-height: 10px; }
.timesheet-summary { font-size: 12px; line-height: 16px; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.timesheet-grid-name { font-size: 13px; line-height: 16px; }
a.timesheet-grid-name { font-weight: 700; }
.timesheet-grid-total--muted { font-weight: 400; color: var(--ink-muted); }
/* On a phone (mobile frames 2l to 2s, 3q to 3y) a person's month is a calendar of seven
   columns from Monday instead of the grid: each day 46 px tall with its number, its code or
   value, and P or R in the corner; the legend and totals stay under it. */
.timesheet-calendar { display: none; }
@media (max-width: 767px) {
  .timesheet-scroll--calendar { display: none; }
  .timesheet-calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
  .timesheet-calendar-weekday { padding-bottom: 4px; font-size: 10px; line-height: 12px; text-align: center; color: var(--ink-subtle); }
  .timesheet-calendar .day-cell { flex-direction: column; gap: 1px; height: auto; min-height: 46px; font-size: 9px; line-height: 10px; }
  .timesheet-calendar .day-cell-number { font-size: 13px; line-height: 16px; font-weight: 400; }
  /* P or R is what a worked day says: 10 px, readable (it was 7 px). */
  .timesheet-calendar .day-cell-mark { left: auto; right: 4px; bottom: 3px; font-size: 10px; line-height: 10px; }
}
/* The day menu (frames 2ac and 2ad; on a phone the sheet 2ae): under the day, like frame mu's
   popover, the day's name and what it holds over Presencial, Remoto and Não trabalhado, the one
   set now on navy-soft with the citrus point, as the sidebar marks its current item; on a
   Bloqueante only Retirar dia. The day keeps a focus ring while it is open. A long-press opens
   it on a phone, so the days select no text and call up no callout there. */
button.day-cell { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
button.day-cell.day-cell--menu { z-index: 4; box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--navy-ink); }
.day-menu {
  position: fixed;
  z-index: 40;
  min-width: 220px;
  margin: 0;
  padding: 0 0 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  box-shadow: var(--shadow-md);
  color: var(--ink);
  font: 400 14px/20px var(--font-sans);
  text-align: left;
}
.day-menu-head { display: flex; flex-direction: column; gap: 2px; margin-bottom: 6px; padding: 10px 12px 8px; border-bottom: 1px solid var(--line); }
.day-menu-title { font-size: 14px; line-height: 20px; font-weight: 700; }
.day-menu-sub { font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.day-menu-form { margin: 0; }
.day-menu-items { display: flex; flex-direction: column; }
.day-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 36px;
  margin: 0;
  padding: 0 12px 0 10px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.day-menu-item[hidden] { display: none; }
.day-menu-item:hover { background: var(--surface-sunken); }
.day-menu-item[aria-checked="true"] { background: var(--navy-soft); }
.day-menu-item:focus-visible { outline: 2px solid var(--navy-ink); outline-offset: -2px; }
.day-menu--pointer .day-menu-item:focus-visible { outline: none; }
.day-menu-point { flex: none; width: 8px; height: 8px; border-radius: var(--radius-full); }
.day-menu-item[aria-checked="true"] .day-menu-point { background: var(--citrus); }
.day-menu-label { flex: 1; white-space: nowrap; }
.day-menu-mark { font-family: var(--font-mono); font-size: 12px; line-height: 16px; font-weight: 700; color: var(--ink-muted); }
.day-menu-cancel { display: none; }
@media (max-width: 767px) {
  dialog.day-menu:modal {
    width: 100%;
    max-width: 100%;
    margin: auto 0 0;
    padding: 20px 16px calc(24px + env(safe-area-inset-bottom));
    border-width: 1px 0 0;
    border-radius: 12px 12px 0 0;
  }
  .day-menu::backdrop { background: var(--scrim); }
  .day-menu:modal .day-menu-head { margin-bottom: 12px; padding: 0 0 12px; }
  .day-menu:modal .day-menu-title { font-size: 20px; line-height: 28px; }
  .day-menu:modal .day-menu-item { height: 44px; border-radius: var(--radius-sm); }
  .day-menu:modal .day-menu-mark { font-size: 13px; }
  .day-menu:modal .day-menu-cancel { display: inline-flex; width: 100%; height: 44px; margin-top: 12px; }
}
/* In the header of a draft: Carregar timesheet and Submeter, what stops it under them. */
.timesheet-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.timesheet-actions-buttons { display: flex; align-items: center; gap: 12px; }
.timesheet-actions-note { max-width: 420px; font-size: 12px; line-height: 16px; color: var(--ink-muted); text-align: right; text-wrap: pretty; }
.timesheet-actions-note:empty { display: none; }
/* Under the grid: Avisos on the left, Ficheiros on the right. */
.timesheet-lists { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 40px; align-items: start; }
.timesheet-files { grid-column: 2; }
.file-list { display: flex; flex-direction: column; }
.file-list-header { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.file-list-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.file-list-icon { flex: none; color: var(--ink-muted); }
.file-list-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.file-list-name { font-family: var(--font-mono); font-size: 13px; line-height: 20px; overflow-wrap: anywhere; }
.file-list-meta { font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.file-list-empty, .warnings-list-empty { padding: 12px 0; color: var(--ink-muted); }
@media (max-width: 1023px) {
  .timesheet-lists { grid-template-columns: minmax(0, 1fr); }
  .timesheet-files { grid-column: auto; }
}
/* On a phone a file is its name, its line and Descarregar under them (mobile frames 2l, 3q). */
@media (max-width: 767px) {
  .file-list-item { flex-direction: column; align-items: flex-start; gap: 4px; }
  .file-list-icon { display: none; }
}

/* ---- Timesheets, the review's (frames 3k, 3l, 3m to 3p, 3aa): queue, month, review ---- */

.queue-warnings { font-weight: 700; color: var(--warning); }
.data-table .num .data-table-sub { font-family: var(--font-sans); }
.timesheet-side { display: flex; flex-direction: column; gap: 32px; min-width: 0; }
.history-list { display: flex; flex-direction: column; }
.history-list-item { display: grid; grid-template-columns: 10px minmax(0, 1fr); gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.history-list-dot { width: 10px; height: 10px; margin-top: 5px; border-radius: var(--radius-full); }
.history-list-dot--submitted { background: var(--navy-ink); }
.history-list-dot--returned { background: var(--warning); }
.history-list-dot--approved { background: var(--success); }
.history-list-dot--sent { background: var(--ink-muted); }
.history-list-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.history-list-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.history-list-when { font-family: var(--font-mono); font-size: 13px; line-height: 20px; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.history-list-who { font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.history-list-note { text-wrap: pretty; }

/* ---- Carregar timesheet (frames 2g, 2h, 2i, 3j): drop zone, preview, refusal ---------- */

.dropzone--page { min-height: 260px; justify-content: center; padding: 32px; border-radius: var(--radius-lg); background: var(--surface-sunken); }
.dropzone--page .dropzone-hint { font-size: 14px; line-height: 20px; max-width: 520px; text-wrap: pretty; }
.dropzone-button { margin-top: 8px; }
.dropzone-button,
.upload-actions .button,
.upload-refusal-actions .button { height: var(--control-height-dense); font-size: 14px; line-height: 20px; }
.upload-pick { display: flex; flex-direction: column; gap: 12px; margin: 0; }
.upload-pick-submit { display: flex; justify-content: center; }
.upload-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; margin: 0; padding: 0; list-style: none; }
.upload-step { display: flex; gap: 12px; align-items: flex-start; }
.upload-step-number {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  background: var(--navy-soft);
  color: var(--navy-ink);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
}
.upload-step-text { color: var(--ink-muted); text-wrap: pretty; }
.file-card { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--radius-md); }
.file-card-icon { flex: none; color: var(--ink-muted); }
.file-card-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.file-card-name { font-family: var(--font-mono); font-size: 13px; line-height: 20px; overflow-wrap: anywhere; }
.file-card-meta, .file-card-saved { font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.file-card-saved { max-width: 360px; text-align: right; overflow-wrap: anywhere; }
.upload-found { display: flex; flex-direction: column; gap: 8px; }
.upload-found-rows { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.upload-found-row {
  display: grid;
  grid-template-columns: 260px minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.upload-found-name { display: flex; flex-direction: column; min-width: 0; }
.upload-found-code { font-family: var(--font-mono); font-size: 13px; line-height: 20px; }
.upload-found-title { font-size: 13px; line-height: 20px; }
.upload-found-sub, .upload-found-key { font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.upload-found-totals { display: flex; flex-wrap: wrap; gap: 20px; }
.upload-found-total { display: flex; flex-direction: column; }
.upload-found-value { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.upload-found-printed { color: var(--ink-muted); }
.upload-found-detail { color: var(--ink-muted); text-wrap: pretty; }
.upload-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin: 0; padding-top: 4px; }
.upload-actions-note { margin-right: auto; font-size: 12px; line-height: 16px; color: var(--ink-muted); text-wrap: pretty; }
.upload-measure { max-width: 760px; }
.upload-refusal { display: flex; flex-direction: column; gap: 4px; }
.upload-refusal-detail { font-family: var(--font-mono); font-size: 13px; line-height: 20px; }
/* A PDF of another month: that month's upload, inside the notice (frame 2i). */
.upload-refusal-link { align-self: flex-start; margin-top: 4px; }
.upload-refusal-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
@media (max-width: 767px) {
  /* Nothing is dragged on a phone (mobile frames 2r, 3x): the zone asks to choose the PDF, and
     Escolher ficheiro is the main action, the whole width. */
  .dropzone--page { min-height: 0; padding: 24px 16px; border-radius: 12px; }
  .dropzone--page .dropzone-button { width: 100%; height: 44px; border-color: transparent; background: var(--primary); color: var(--on-primary); }
  .upload-steps, .upload-found-row { grid-template-columns: minmax(0, 1fr); }
  .file-card { flex-wrap: wrap; }
  .file-card-saved { max-width: none; text-align: left; }
  .upload-refusal-actions { flex-direction: column-reverse; align-items: stretch; gap: 8px; }
  .upload-refusal-actions .button:not(.button--link) { width: 100%; height: 44px; }
  .upload-refusal-link { display: inline-flex; align-items: center; min-height: 44px; margin-top: 0; }
}

/* On a phone a draft's actions, and a preview's, sit in a bar pinned to the bottom of the
   screen (mobile frames 2l, 2s, 3q, 3y): the main one first, each the whole width and 44 px
   tall, what stops it or what saving does under them; the page leaves room for the bar, and
   the toasts show above it. Retirar dia and Descarregar are 44 px tall to the touch. A page's
   main action does the same in an action-bar (mobile frames 9u, 11z), which wider than a phone
   leaves its button in the page's header as it was. */
.action-bar { display: contents; }
@media (max-width: 767px) {
  .timesheet-actions,
  .upload-actions,
  .action-bar {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 15;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: var(--surface);
  }
  .timesheet-actions-buttons { flex-direction: column-reverse; align-items: stretch; gap: 8px; }
  .action-bar { display: flex; }
  .timesheet-actions .button:not(.button--link),
  .upload-actions .button:not(.button--link),
  .action-bar .button:not(.button--link) { width: 100%; height: 44px; }
  .timesheet-actions-note, .upload-actions-note { max-width: none; margin: 0; text-align: center; }
  .upload-actions .button--primary { order: -2; }
  .upload-actions .button--secondary { order: -1; }
  .app-main:has(.timesheet-actions, .upload-actions) { padding-bottom: 176px; }
  body:has(.timesheet-actions, .upload-actions) .toast-region { bottom: 168px; }
  /* A draft's Apagar in the bar (G11.3): a tap target as tall as the buttons, the bar taller. */
  .timesheet-actions .button--link-danger { height: 44px; }
  .app-main:has(.timesheet-actions .button--link-danger:not([hidden])) { padding-bottom: 228px; }
  body:has(.timesheet-actions .button--link-danger:not([hidden])) .toast-region { bottom: 220px; }
  .app-main:has(.action-bar) { padding-bottom: calc(100px + env(safe-area-inset-bottom)); }
  body:has(.action-bar) .toast-region { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .warnings-list-action { height: auto; min-height: 44px; }
  .file-list-item .button--link { min-height: 44px; }
}

/* ---- Extratos mensais (frames 6a, 6b): the month's contracts and a statement ------------- */

.data-table .actions form { display: inline; margin: 0; }
.statement-badges { display: inline-flex; flex-wrap: wrap; gap: 8px; }
.statement-notices { display: flex; flex-direction: column; gap: 12px; }
.statement-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.statement-actions-buttons { display: flex; align-items: center; gap: 12px; }
.statement-actions-note { max-width: 360px; font-size: 12px; line-height: 16px; color: var(--ink-muted); text-align: right; text-wrap: pretty; }
/* On a phone the buttons wrap under one another, from the left, and so does what they say. */
@media (max-width: 767px) {
  .statement-actions { align-items: flex-start; }
  .statement-actions-buttons { flex-wrap: wrap; }
  .statement-actions-note { text-align: left; }
}

/* Preparar email (frame 6f): 720 px, Para and Assunto side by side, then the email as the
   accountant will see it; it scrolls inside the dialog when it is taller than the window. */
.email-dialog { width: 720px; max-height: calc(100vh - 48px); overflow: auto; }
.email-dialog-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.email-dialog-fields--stacked { grid-template-columns: minmax(0, 1fr); }
.email-preview { padding: 20px 24px; border: 1px solid var(--line); border-radius: var(--radius-md); background: #ffffff; }
/* The email styles itself, as in Gmail: the dialog's muted paragraphs stay out of it. */
.confirm-dialog .email-preview p { color: inherit; text-wrap: wrap; }
.email-preview--text { white-space: pre-line; color: #1a1a1a; }
.confirm-dialog .email-dialog-note { font-size: 12px; line-height: 16px; }
@media (max-width: 767px) { .email-dialog-fields { grid-template-columns: minmax(0, 1fr); } }
/* The client's email's attachments, between its fields and its text (G22.2, frame 26e): each
   PDF with the contract it bills and its date. */
.email-attachments { display: flex; flex-direction: column; gap: 6px; }
.email-attachments ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.email-attachments li { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); font-size: 13px; line-height: 20px; }
.email-attachments li .icon { flex: none; color: var(--ink-muted); }
.email-attachment-name { font-weight: 700; color: var(--ink); }
.email-attachment-note { color: var(--ink-muted); }
@media (max-width: 767px) { .email-attachments li { width: 100%; } }
/* Copiar inside Para and Assunto, at the field's end. */
.form-control-copy { position: absolute; right: 12px; font-size: 14px; line-height: 20px; }
.form-control:has(.form-control-copy) input { padding-right: 84px; }

/* ---- Componentes page (Admin): the components laid out as in frame 1a ------------------- */

.showcase-section { display: flex; flex-direction: column; gap: 16px; padding-top: 32px; border-top: 1px solid var(--line); }
.showcase-code { font: 500 11px/16px var(--font-mono); padding: 2px 6px; border-radius: var(--radius-sm); background: var(--surface-sunken); color: var(--ink-muted); font-weight: 400; }
.showcase-row { display: grid; grid-template-columns: 160px 1fr; gap: 16px; align-items: start; }
.showcase-label { font-size: 12px; line-height: 16px; font-weight: 700; color: var(--ink-muted); padding-top: 3px; }
.showcase-items { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 28px; }
.showcase-cells { display: flex; flex-wrap: wrap; gap: 20px 12px; }
.showcase-cell { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 140px; font-size: 12px; line-height: 16px; text-align: center; }
.showcase-cell .day-cell { width: 40px; }
.showcase-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 24px; align-items: center; }
.showcase-toast .toast { animation: none; }
@media (max-width: 767px) { .showcase-grid, .showcase-row { grid-template-columns: 1fr; } }

/* ---- Faturas (frames 6g to 6l): the invoice dialog's comparison with the expected amount ---- */
.invoice-equal { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 12px; line-height: 16px; color: var(--success); }
.invoice-equal[hidden], [data-invoice-warn][hidden] { display: none; }

/* ---- Despesas (frames 9a to 9t) --------------------------------------------------------- */

/* A page's key amounts, one card each (frames 9a, 9d). */
.figures { display: flex; flex-wrap: wrap; gap: 16px; }
.figure { flex: 0 1 256px; min-width: 0; display: flex; flex-direction: column; gap: 4px; padding: 16px 20px; border: 1px solid var(--line); border-radius: var(--radius-md); }
/* What is overdue (Faturas a clientes, G20.1, frame 24b): the value in red. */
.figure--danger .figure-value { color: var(--danger); }
.figure-label, .figure-sub { font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.figure-value { font-family: var(--font-mono); font-size: 24px; line-height: 32px; font-weight: 700; font-variant-numeric: tabular-nums; }
/* On a phone the figures go one under the other, the whole width, 8 px apart (mobile frames 9u,
   11z). */
@media (max-width: 767px) {
  .figures { flex-direction: column; gap: 8px; }
  .figure { flex: none; gap: 2px; padding: 12px 16px; }
  .figure-value { font-size: 22px; line-height: 28px; }
}

/* Carregar despesa (frames 9b, 9h): 600 px; a title with no text under it. */
.confirm-dialog--upload { width: 600px; }
.confirm-dialog form > h3 { margin: 0; }
/* Registar fatura's live region, empty until its PDF is read: out of the dialog's flow, so no gap,
   but still there for a screen reader to hear what is read. */
.confirm-dialog [data-invoice-read]:empty { position: absolute; }

/* A dialog's dropzone: smaller than a page's and on the sunken surface, the chosen file in a
   box under it. */
.file-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 20px 16px;
  border: 2px dashed var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface-sunken);
  text-align: center;
  cursor: pointer;
}
.file-drop-icon { color: var(--ink-muted); }
.file-drop-title { text-wrap: pretty; }
.file-drop-hint { font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.form-field--file-drop:focus-within .file-drop { box-shadow: var(--focus-ring); }
.form-field--file-drop.dropzone--active .file-drop { border: 2px solid var(--navy-ink); background: var(--navy-soft); }
.form-field--file-drop.dropzone--active .file-drop-icon { color: var(--navy-ink); }
.form-field--file-drop.form-field--error .file-drop { border-color: var(--danger); }
.file-drop-file { display: none; align-items: center; gap: 10px; min-height: 40px; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); color: var(--ink-muted); }
.file-drop-file [data-dropzone-file] { flex: 1; min-width: 0; font-family: var(--font-mono); font-size: 13px; line-height: 20px; color: var(--ink); overflow-wrap: anywhere; }
.dropzone--has-file .file-drop-file { display: flex; }
@media (max-width: 767px) { .file-drop, .file-drop-file { min-height: 44px; } } /* mobile frame 9v */

/* Pago por: round buttons on one line; for the company, Pela empresa alone. */
.radio-options { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; min-height: 40px; }
.radio-option { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.radio-option input { margin: 0; }
.radio-option[hidden] { display: none; }
/* On a phone the options go one under the other, each 44 px tall (mobile frame 9v). */
@media (max-width: 767px) {
  .radio-options { flex-direction: column; align-items: stretch; gap: 0; }
  .radio-option { gap: 10px; min-height: 44px; }
}

/* A row's note across the columns, under it: a rejected expense's (frame 9a). */
.data-table tr:has(+ .data-table-note-row) td { padding-bottom: 8px; border-bottom: 0; }
.data-table-note-row td { padding: 0 0 12px; }
.data-table-note { margin: 0; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--danger-soft); font-size: 12px; line-height: 16px; text-wrap: pretty; }
/* On a phone an expense is a card (mobile frame 9u, data-table--cards): the date and the value on
   top, the supplier, Categoria, Contrato and Pago por side by side, the badge with its line, the
   note, then the links. Its row and its note share a tbody, whose grid lays out their cells. */
@media (max-width: 767px) {
  .expense-cards tbody {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
  }
  .expense-cards tr { display: contents; }
  .expense-cards tr:has(+ .data-table-note-row) td, .expense-cards .data-table-note-row td { padding: 0; }
  .expense-cards .expense-cards-date { grid-area: 1 / 1 / 2 / 3; }
  .expense-cards td.expense-cards-amount { grid-area: 1 / 3; text-align: right; }
  .expense-cards .expense-cards-supplier,
  .expense-cards .expense-cards-state,
  .expense-cards .data-table-note-row td,
  .expense-cards .actions { grid-column: 1 / -1; }
  .expense-cards td[data-label] .mono { font-size: 13px; }
  .expense-cards .expense-cards-state { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
  .expense-cards .data-table-note-row td { order: 1; }
  .expense-cards .actions { order: 2; }
}

/* Todas (frame 9j): what the month sent to Contabilidade, added up under its table. */
.data-table-total { margin: 0; padding-top: 12px; font-weight: 700; font-variant-numeric: tabular-nums; text-wrap: pretty; }

/* Fecho do mês (frames 9k to 9o): Fechar, or Reabrir, with what stops Fechar under them; a
   file's name wraps anywhere in its column. */
.close-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.close-actions-buttons { display: flex; align-items: center; gap: 12px; }
.close-actions-note { max-width: 360px; font-size: 12px; line-height: 16px; color: var(--ink-muted); text-align: right; text-wrap: pretty; }
@media (max-width: 767px) {
  .close-actions { align-items: flex-start; }
  .close-actions-buttons { flex-wrap: wrap; }
  .close-actions-note { text-align: left; }
}
.data-table-file { overflow-wrap: anywhere; }

/* Custos fixos (frames 9p to 9r): a column per month, 6 px apart, its amounts small. A month's
   tone says what it is: actual (success with a check, or navy while its invoice waits for
   approval), ended without an invoice (warning), or planned (muted); Confirmar sits under the
   amount. The months' totals close the table, bold. */
.cost-table td, .cost-table th { padding-right: 6px; }
.cost-table td:last-child, .cost-table th:last-child { padding-right: 0; }
.cost-cell { font-size: 12px; line-height: 16px; }
.cost-cell--confirmed { color: var(--success); }
.cost-cell--awaiting { color: var(--navy-ink); }
.cost-cell--to-confirm { color: var(--warning); }
.cost-cell--planned, .cost-cell--muted, .cost-cell--inactive { color: var(--ink-muted); }
.cost-cell .cost-cell-check { display: inline-block; margin-right: 2px; vertical-align: -1px; }
.cost-cell-sub { display: block; font-family: var(--font-sans); font-size: 11px; line-height: 14px; font-weight: 400; color: var(--ink-muted); }
.cost-cell-sub--due { color: var(--warning); }
.cost-cell-link { display: block; margin-left: auto; font-family: var(--font-sans); font-size: 12px; line-height: 16px; }
.cost-links { display: flex; flex-wrap: wrap; gap: 0 12px; font-family: var(--font-sans); font-size: 12px; line-height: 16px; }
.cost-total td { border-bottom: 0; }

/* ---- Salários (frames 10a to 10l) ------------------------------------------------------- */

/* The payslips' table (frame 10e): nine columns 12 px apart, as the frame spaces them. */
.payroll-table td, .payroll-table th { padding-right: 12px; }
.payroll-table td:last-child, .payroll-table th:last-child { padding-right: 0; }

/* A salary's badges on one line: Pago, and beside it Mudou depois de pago (frame 10l). */
.status-badges { display: inline-flex; flex-wrap: wrap; gap: 4px 8px; }

/* A payslip's dialog (frames 10b to 10d): 680 px, Copiar de <mês> beside the text, the notice
   that the figures were copied, the PDF already in Documentos in the chosen file's box, the
   figures under the headings of their groups, and Editar's Apagar recibo at the left of the
   buttons. */
.confirm-dialog--payslip { width: 680px; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.dialog-head > .button { flex: none; }
.notice--navy { background: var(--navy-soft); }
[data-payslip-notice][hidden] { display: none; }
.file-drop-file--kept { display: flex; }
.form-grid-group {
  grid-column: 1 / -1;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  line-height: 16px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.confirm-dialog-aside { margin-right: auto; }
@media (max-width: 767px) {
  .dialog-head { flex-direction: column; }
  .confirm-dialog-aside { margin-right: 0; }
}

/* Ao Estado (frames 28a to 28g): a deadline passed in the danger tone; the notice of an IRS that
   differs from the payslips between the heading and the rows; a button that waits, greyed, with
   the reason under it (Deslocações). */
.state-notice { margin-bottom: 12px; }
.state-deadline--passed { font-weight: 700; color: var(--danger); }
.button--link:disabled:hover { background: transparent; }
.state-why {
  display: block;
  max-width: 260px;
  margin: 4px 0 0 auto;
  font-size: 12px;
  line-height: 16px;
  color: var(--ink-muted);
  text-align: right;
  white-space: normal;
  text-wrap: pretty;
}

/* Ajudas de custo on the person's page (frames 11c to 11f): a rule above its limit carries its
   flag under the date. The rule's dialog and Registar deslocação (frames 11d, 11e, 11h, 11r) are
   640 px. */
.rule-flag { display: block; margin-top: 4px; }
.confirm-dialog--rule, .confirm-dialog--trip { width: 640px; }
/* On a phone (mobile frame 11aa) Partida and Hora de partida, and Regresso and Hora de regresso,
   sit side by side; every other field takes the whole width. */
@media (max-width: 767px) {
  .confirm-dialog--trip .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 12px; }
  .confirm-dialog--trip .form-grid > :not(.form-field--date, .form-field--time) { grid-column: 1 / -1; }
}

/* The month's boletim on Pessoal › Deslocações (frames 11g, 11k): its title with the state, the
   file and when it was made, what to do, then its buttons, a greyed one with why under them. */
.boletim-card { gap: 12px; }
.boletim-card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.boletim-card-sub, .boletim-card-text { margin: 0; }
.boletim-card-sub { font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.boletim-card-text { max-width: 760px; text-wrap: pretty; }
/* On a phone (mobile frames 11z to 11ai) a trip is a card (data-table--cards): its departure and
   return on one line in mono, "regresso previsto" under it, the place, the reason and the
   transport, then Dias, Valor and Recibos side by side and the links, why some are missing under
   them. The boletim's buttons go one under the other, the whole width and 44 px tall, why one
   waits centred under them. */
@media (max-width: 767px) {
  .trip-cards tr {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
  }
  .trip-cards .trip-cards-departs, .trip-cards .trip-cards-returns .mono { font-size: 13px; line-height: 20px; }
  .trip-cards .trip-cards-returns { display: contents; }
  .trip-cards .trip-cards-returns .mono::before { content: "→ "; }
  .trip-cards .trip-cards-returns .data-table-sub,
  .trip-cards .trip-cards-line,
  .trip-cards .actions,
  .trip-cards td[colspan] { flex: 0 0 100%; }
  .trip-cards td[data-label] { flex: 1 1 0; }
  .trip-cards .state-why { max-width: none; margin: 0; text-align: left; }
  .boletim-card { padding: 16px; }
  .boletim-card .side-card-buttons { flex-direction: column; align-items: stretch; gap: 8px; }
  .boletim-card .side-card-buttons form { display: flex; flex-direction: column; }
  .boletim-card .side-card-buttons .button { width: 100%; height: 44px; }
  .boletim-card .button-reason { text-align: center; }
}

/* A payslip's Ajudas de custo (frame 11v): the boletins it may pay, a line each with when it was
   confirmed under it, and their total, read-only. */
.checklist { display: flex; flex-direction: column; gap: 4px; }
.checklist-item { align-items: flex-start; min-height: 0; padding: 6px 0; }
.checklist-item input { margin-top: 2px; }
.checklist-sub { display: block; font-size: 12px; line-height: 16px; font-weight: 400; color: var(--ink-muted); }
.checklist-none { margin: 0; color: var(--ink-muted); }

/* ---- Previsão (frames 12b, 12c) --------------------------------------------------------- */

/* The year month by month: a column per month, 6 px apart, its amounts small; each month's
   state in a small badge under its name (Real locked, Por fechar, Previsto outlined); a real
   value in ink and a projected one muted, the result on a navy-soft row. */
/* Narrower than a month's column needs (68 px: 12.345,67 in bold), the table scrolls sideways,
   as the other month grids do, with room for the result row's navy edge; relative, so the screen
   reader's month names (visually-hidden) scroll with it too. */
.forecast-scroll { position: relative; overflow-x: auto; margin: 0 -8px; padding: 0 8px; }
.forecast-table { min-width: calc(248px + var(--months, 12) * 68px); }
.forecast-table td, .forecast-table th { padding-right: 6px; }
.forecast-table td:last-child, .forecast-table th:last-child { padding-right: 0; }
.forecast-table th.num { vertical-align: top; }
.forecast-table th .status-badge { display: flex; width: fit-content; margin: 4px 0 0 auto; gap: 3px; padding: 1px 6px; font-size: 10px; line-height: 14px; }
.forecast-table th .status-badge--previsto { padding: 0 5px; }
.forecast-table th .status-badge svg { width: 10px; height: 10px; }
.forecast-cell { font-size: 12px; line-height: 16px; }
.forecast-cell--projected { color: var(--ink-muted); }
.forecast-result td { padding-top: 8px; padding-bottom: 8px; background: var(--navy-soft); }
.forecast-result td:first-child { box-shadow: -8px 0 0 var(--navy-soft); }
.forecast-result td:last-child { box-shadow: 8px 0 0 var(--navy-soft); }

/* The adjustments (frame 12e): a row each, its value with its effect in mono; one whose month
   closed since no longer counts, and shows muted. */
.forecast-adjustments td.num { white-space: nowrap; }
.forecast-adjustment--gone td, .forecast-adjustment--gone td b { color: var(--ink-muted); }

/* The assumptions: a list 900 px wide at most, 8 px between items, and the foot under it. */
.forecast-assumptions { display: flex; flex-direction: column; gap: 12px; }
.forecast-assumptions ul { display: flex; flex-direction: column; gap: 8px; max-width: 900px; margin: 0; padding-left: 20px; }
.forecast-assumptions li { text-wrap: pretty; }
.forecast-assumptions .footnote { padding-top: 0; }

/* Cenários (G14.1, frames 18a1 to 18e). A scenario's year: a wider first column for the changes'
   names, a heading row for each group of rows, the forecast's result over a strong rule, and
   the difference from the forecast in ink, not muted. */
.scenario-table { min-width: calc(272px + var(--months, 12) * 70px); }
.scenario-table .scenario-label-col { width: 176px; }
.scenario-group th { padding: 18px 0 6px; font-size: 11px; line-height: 16px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-muted); text-align: left; }
.scenario-subtotal td { border-bottom-color: var(--line-strong); }
.scenario-change td:first-child b { font-weight: 700; }
.scenario-diff td { padding-top: 10px; padding-bottom: 10px; border-bottom: 0; }
.scenario-diff td.forecast-cell, .scenario-diff td.forecast-cell b { color: var(--ink); }
/* The list: the forecast pinned first, a scenario's name leading to its page, its actions a
   link each (Duplicar is a form). */
.scenario-list .scenario-baseline td { background: var(--surface-sunken); }
.scenario-list .scenario-baseline td:first-child { box-shadow: -8px 0 0 var(--surface-sunken); }
.scenario-list .scenario-baseline td:last-child { box-shadow: 8px 0 0 var(--surface-sunken); }
.scenario-list .table-actions form { margin: 0; display: inline-flex; }
.scenario-link { font-weight: 700; color: var(--ink); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
/* A scenario's changes: the effect on one line, a total row without a rule under it. */
.scenario-changes-total td { border-bottom: 0; }
.scenario-changes td.num { white-space: nowrap; }
/* Valor mensal's dialog is wider (640 px), the three numbers under its note in ink and muted. */
.confirm-dialog--scenario { width: 640px; }
.confirm-dialog--scenario .dialog-side-facts > div { font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.confirm-dialog--scenario .dialog-side-facts b { color: var(--ink); white-space: nowrap; }
.page-actions form { margin: 0; }

/* Cenários, the what-ifs (G14.2, frames 18c2 and 18f to 18k). Nova alteração: a menu under its
   button, a <details> that works without the script, an item per kind with a line under its
   title; the one greyed says why under its title. */
.scenario-menu-wrap { position: relative; display: inline-block; }
.scenario-menu-wrap > summary { display: inline-flex; align-items: center; gap: 6px; list-style: none; cursor: pointer; }
.scenario-menu-wrap > summary::-webkit-details-marker { display: none; }
.scenario-menu { position: absolute; top: calc(100% + 6px); right: 0; z-index: 31; width: 420px; max-width: calc(100vw - 32px); padding: 6px; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow-md); }
.scenario-menu-item { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 9px 12px; border: 0; border-radius: var(--radius-sm); background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.scenario-menu-item b { font-size: 14px; line-height: 20px; }
.scenario-menu-item span { font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.scenario-menu-item:hover:not(:disabled), .scenario-menu-item:focus-visible { background: var(--navy-soft); }
.scenario-menu-item:disabled { cursor: default; }
.scenario-menu-item:disabled b { color: var(--ink-muted); }
.scenario-menu-sep { height: 1px; margin: 4px 6px; background: var(--line); }
/* The what-ifs' dialogs: four numbers in a row, a before → after line, the list of what stops. A
   field of one way only (a contract's name, a fixed cost's) is a cell the script hides. */
.dialog-side-facts--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.scenario-ba { display: flex; align-items: baseline; gap: 12px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius-md); }
.scenario-ba[hidden], .confirm-dialog .notice[hidden] { display: none; }
.scenario-ba-label { min-width: 88px; font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.scenario-ba-values { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.scenario-ba-values s { color: var(--ink-muted); }
.scenario-ba-sub { margin-left: auto; font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.scenario-effects { margin: 6px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.confirm-dialog .notice--navy .scenario-effects li { color: var(--ink); }
.whatif-cell[hidden] { display: none; }
.whatif-cell--wide { grid-column: 1 / -1; }

/* The margin (frame 12f): a table per contract and per person, each group of columns (the months
   closed, then the year) named on a row above the head, over a strong rule, 12 px between
   columns. Narrower than the columns and a name of 160 px need, a table scrolls sideways, as the
   month table does. Someone deactivated shows muted. */
.forecast-margin { min-width: 1000px; }
.forecast-margin--days { min-width: 1136px; }
.forecast-margin .forecast-margin-days { width: 68px; }
.forecast-margin .forecast-margin-amount { width: 116px; }
.forecast-margin .forecast-margin-share { width: 72px; }
.forecast-margin th, .forecast-margin td { padding-right: 12px; }
.forecast-margin th:last-child, .forecast-margin td:last-child { padding-right: 0; }
.forecast-margin td.num { white-space: nowrap; }
.forecast-margin-groups th, .forecast-margin-groups td {
  padding: 0 0 6px;
  border-bottom: 1px solid var(--line-strong);
  color: var(--ink);
  text-align: center;
}
.forecast-margin-groups + tr th { padding-top: 8px; }
.forecast-margin-row--inactive td, .forecast-margin-row--inactive td b { color: var(--ink-muted); }

/* Documentos da empresa (G10.1, frames 13a to 13j): the Validade cell in its tone, and a replaced
   or not renewed document muted, under Todos. */
.company-validity { display: block; font-weight: 700; }
.company-validity--valid { color: var(--success); }
.company-validity--expiring { color: var(--warning); }
.company-validity--expired { color: var(--danger); }
.company-validity--muted { color: var(--ink-muted); }
.company-documents-row--muted td, .company-documents-row--muted b { color: var(--ink-muted); }
/* A record's documents block (G10.2, frames 14a, 14c): the sub-heading of what another record
   shows read-only, a contract's under its customer, the people's under a contract. */
.record-documents-group th, .record-documents-group td { padding-top: 16px; font-weight: 700; background: var(--surface-sunken); }
.record-documents-group .data-table-sub { font-weight: 400; }

/* Lado a lado (G14.3, frames 18b and 18l). The list's pick box and the form of Ver lado a lado;
   the toolbar with the year and three scenario selects in one form; the forecast's result row
   shaded, a scenario's bold under it with its difference in each month beneath; the table at 31
   December with a column each, the scenarios' names over their changes counted. */
.scenario-pick { vertical-align: middle; }
.scenario-compare-form { margin: 0; }
.toolbar-form { display: flex; align-items: center; gap: 12px; }
.toolbar-select.scenario-select select { width: 260px; }
.scenario-side-name td { border-bottom: 0; padding-bottom: 2px; }
.scenario-side-diff td { padding-top: 0; }
.scenario-side-diff td:first-child { padding-left: 12px; color: var(--ink-muted); font-size: 12px; }
.scenario-side-base td { background: var(--surface-sunken); }
.scenario-compare th.num { vertical-align: bottom; font-family: var(--font-sans); }
.scenario-col-name { display: block; font-size: 14px; line-height: 20px; color: var(--ink); text-transform: none; letter-spacing: 0; }
.scenario-compare .forecast-result td { background: var(--navy-soft); }
.scenario-compare-open td { border-bottom: 0; }

/* Simulações (G18.1, frames 22a to 22e): a simulation's team, edited in its table with the form's
   own fields, 36 px high so a row stays a row; "/mês" or "/dia" as the field's suffix. A refused
   field's message under it, in the cell. */
.sim-team td { vertical-align: middle; padding-top: 6px; padding-bottom: 6px; }
.sim-team .form-field :where(input, select) { height: 36px; font-size: 14px; line-height: 20px; }
.sim-team .form-control-suffix { right: 10px; font-size: 12px; line-height: 16px; }
.sim-team .form-control:has(.form-control-suffix) input { padding-right: 44px; }
.sim-team input[name$="-days"] { padding-inline: 8px; } /* three digits in a 64 px column */
.sim-team .form-field-messages { white-space: normal; }
.sim-team td.actions form { margin: 0; display: inline-flex; }
.sim-team tr[hidden] { display: none; }

/* ---- Pesquisar (G15.1, frames 19a to 19g, 19k to 19m): the sidebar's field, the pop-up --- */
/* over the page (a sheet over the whole screen on a phone) and the results page, built from the
   lists' search field, the sidebar's labels, the dialogs' scrim, the chips and the tables. One
   citrus point: the highlighted row. */

/* The sidebar's field, under the brand, the width of the menu. */
.sidebar-search { margin: -8px 0 0; }
.sidebar-search .form-field--search { width: 100%; }
.search-kbd {
  flex: none;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 18px;
  color: var(--ink-muted);
}
.search-kbd[hidden] { display: none; }

/* The pop-up: 640 px wide, 72 px from the top, over the scrim. */
.search-dialog {
  position: fixed;
  inset: 72px 0 auto;
  width: 640px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 96px);
  margin: 0 auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-md);
  font-size: 14px;
  line-height: 20px;
  overflow: hidden;
}
.search-dialog[open] { display: flex; flex-direction: column; }
.search-dialog::backdrop { background: var(--scrim); }
.search-dialog form { display: flex; flex-direction: column; min-height: 0; margin: 0; }
.search-body { display: flex; flex-direction: column; min-height: 0; }
.search-field {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 56px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-muted);
}
.search-field input {
  flex: 1;
  min-width: 0;
  height: 40px;
  padding: 0;
  border: 0;
  outline: none;
  appearance: none;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  line-height: 24px;
  text-overflow: ellipsis; /* the hint, on a phone beside Cancelar */
}
.search-field input::placeholder { color: var(--ink-subtle); }
/* The field is the pop-up's top bar, its caret the focus (the frames draw no ring there). */
.search-field input:focus-visible { box-shadow: none; }
.search-field input::-webkit-search-cancel-button { display: none; }
.search-sheet-cancel { display: none; }
.search-results { display: flex; flex-direction: column; gap: 4px; min-height: 0; padding: 8px; overflow-y: auto; }
.search-group { display: flex; flex-direction: column; }
.search-group-label {
  padding: 8px 12px 4px;
  font-size: 11px;
  line-height: 16px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-subtle);
}
.search-row {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 12px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--ink);
  text-decoration: none;
}
.search-row:hover { background: var(--surface-sunken); color: var(--ink); }
.search-row-point { width: 8px; height: 8px; border-radius: var(--radius-full); }
.search-row--active, .search-row--active:hover { background: var(--navy-soft); }
.search-row--active .search-row-point { background: var(--citrus); }
.search-row-main { min-width: 0; display: flex; flex-direction: column; }
.search-row-title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-row-sub { font-size: 12px; line-height: 16px; color: var(--ink-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-row-end { display: flex; align-items: center; gap: 12px; font-size: 12px; line-height: 16px; color: var(--ink-muted); }
/* A document's row says it downloads (G15.2, frames 19c, 19e). */
.search-row-end .button--link { font-size: 12px; line-height: 16px; }
.search-enter { visibility: hidden; font-family: var(--font-mono); color: var(--ink); }
.search-row--active .search-enter { visibility: visible; }
.search-row mark { background: transparent; color: inherit; box-shadow: inset 0 -3px 0 var(--citrus); }
.search-foot {
  flex: none;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface-sunken);
  font-size: 12px;
  line-height: 16px;
  color: var(--ink-muted);
}
.search-foot .search-kbd { margin-right: 4px; }
.search-foot-all { margin-left: auto; padding: 0; border: 0; background: none; font: inherit; font-weight: 700; color: var(--link); cursor: pointer; }
.search-foot-all:hover { color: var(--ink); }

/* Nothing found: one line, what search looks in, and a way on. */
.search-empty { display: flex; flex-direction: column; gap: 8px; padding: 24px 20px 20px; }
.search-empty p { margin: 0; color: var(--ink-muted); text-wrap: pretty; }
.search-empty .button--link { align-self: flex-start; }

/* The results page: the query, chips by kind (buttons, the query posted with them), a block
   per kind. */
.search-page-form .form-field--search { width: 480px; }
button.filter-chip { background: none; font-family: inherit; cursor: pointer; }
button.filter-chip--current { background: var(--navy-soft); }
.search-blocks { display: flex; flex-direction: column; gap: 32px; }
.search-block .section-header { margin-bottom: 4px; }
.search-place { font-size: 12px; line-height: 16px; color: var(--ink-muted); }

/* By touch, and wherever the phone's header shows, Cancelar in place of esc. */
@media (max-width: 1023px), (pointer: coarse) {
  .search-esc { display: none; }
  .search-sheet-cancel {
    display: block;
    flex: none;
    height: 44px;
    padding: 0 8px;
    border: 0;
    background: transparent;
    font: inherit;
    font-weight: 700;
    color: var(--link);
  }
}
/* The phone: a sheet over the whole screen, a 16 px field, 44 px rows, Cancelar. */
@media (max-width: 767px) {
  .search-dialog {
    inset: 0;
    width: 100%;
    max-width: none;
    height: 100%;
    max-height: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .search-dialog form, .search-body { flex: 1; }
  .search-field { padding: 0 8px 0 16px; }
  .search-results { flex: 1; padding: 8px 8px 24px; }
  .search-row { min-height: 44px; padding: 12px; }
  /* A row keeps its state (G15.2: a record's, a month page's), not ↵ nor Descarregar (19l). */
  .search-row-end .search-enter, .search-row-end .button--link { display: none; }
  .search-key-hint { display: none; }
  .search-foot-all { min-height: 44px; }
  .search-page-form .form-field--search { width: 100%; }
}
@media (max-width: 767px) {
  .search-foot:not(:has(.search-foot-all)) { display: none; }
}

/* ---- O mês (G21.2, frames 25a to 25j): the month's work as five steps in order ------------- */
/* How many of the five steps are done, under the subtitle. */
.month-progress { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; width: 240px; margin-top: 12px; }
.month-progress-part { height: 6px; border-radius: var(--radius-full); background: var(--line); }
.month-progress-part--done { background: var(--success); }
/* The steps: a mark per step on a line that joins them, the step beside it. */
.month-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.month-step { position: relative; display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 0 16px; padding-bottom: 32px; }
.month-step:last-child { padding-bottom: 0; }
.month-step:not(:last-child)::before { content: ""; position: absolute; left: 15px; top: 36px; bottom: 4px; width: 2px; border-radius: 1px; background: var(--line); }
.month-step-mark { box-sizing: border-box; width: 32px; height: 32px; display: grid; place-items: center; border: 2px solid var(--line-strong); border-radius: var(--radius-full); background: var(--surface); color: var(--ink-muted); font-size: 14px; line-height: 20px; font-weight: 700; }
.month-step--done .month-step-mark { border-color: var(--success); background: var(--success); color: var(--on-status); }
.month-step--todo .month-step-mark { border-color: var(--navy-ink); color: var(--ink); }
.month-step--wait .month-step-mark { color: var(--ink-muted); }
.month-step--later .month-step-mark { border-style: dashed; }
/* Agora: the first step waiting for Admin, on navy-soft with the citrus point, as the sidebar
   marks its current place. */
.month-step--now .month-step-mark { border-color: var(--navy-ink); background: var(--navy-soft); color: var(--ink); }
.month-step--now .month-step-state b::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: var(--radius-full); background: var(--citrus); vertical-align: 1px; }
.month-step-body { display: flex; flex-direction: column; gap: 8px; min-width: 0; padding-top: 4px; }
.month-step-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 12px; padding-right: 96px; }
.month-step-state { font-size: 14px; line-height: 20px; color: var(--ink-muted); }
.month-step-state b { font-weight: 700; color: var(--ink); }
.month-step-what { margin: 0; font-size: 13px; line-height: 20px; color: var(--ink-muted); max-width: 80ch; text-wrap: pretty; }
.month-step-empty { margin: 0; padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--ink-muted); }
/* A done step folds to its line; Mostrar, on the line's right, opens it, without JavaScript. */
.month-step-fold { display: flex; flex-direction: column; gap: 8px; }
.month-step-fold > summary { position: absolute; top: 4px; right: 0; list-style: none; cursor: pointer; }
.month-step-fold > summary::-webkit-details-marker { display: none; }
.month-step-fold[open] .month-step-show, .month-step-fold:not([open]) .month-step-hide { display: none; }
.month-step-fold:not([open]) { gap: 0; }
/* Two states a row adds: an invoice sent to the client, and a freelancer's invoice waiting for
   the client to pay (outlined in dashes: someone else's move). */
.status-badge--enviada { color: var(--success); background: var(--success-soft); }
.status-badge--a-espera-do-cliente { padding: 1px 7px; color: var(--ink-muted); background: transparent; border: 1px dashed var(--line-strong); }
/* Step 3's two states of the client's email (G22.3, frames 26g, 26i): an email waiting for
   Enviar, Admin's move, and a client with no address to send to, which stops it. */
.status-badge--email-por-enviar { color: var(--navy-ink); background: var(--navy-soft); }
.status-badge--sem-email { color: var(--warning); background: var(--warning-soft); }
/* The month's other things, under the steps: Finanças' cards, four in a row. */
.month-also-cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.month-also .hub-card { padding: 12px 16px; gap: 4px; }
.month-step .table-actions form { display: inline; }
@media (max-width: 1023px) { .month-also-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* A phone: the mark smaller, Mostrar under the line, and each row a card of two columns, the
   move on the right (frame 25i). */
@media (max-width: 767px) {
  .month-progress { width: 100%; }
  .month-step { grid-template-columns: 28px minmax(0, 1fr); gap: 0 12px; padding-bottom: 28px; }
  .month-step-mark { width: 28px; height: 28px; font-size: 13px; }
  .month-step:not(:last-child)::before { left: 13px; top: 32px; }
  .month-step-head { padding-right: 0; }
  .month-step-fold > summary { position: static; align-self: flex-start; }
  .month-also-cards { grid-template-columns: minmax(0, 1fr); }
  .month-step .data-table--cards tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .month-step .data-table--cards td { grid-column: 1; }
  .month-step .data-table--cards td.actions { grid-column: 2; grid-row: 1 / span 3; align-self: center; }
}
