/* ZEFRA design system — componentes.
   Requer tokens/tokens.css. Mantém os nomes de classe dos apps atuais
   (.app-shell .sidebar .card .btn .pill .alert .auth-card …) e acrescenta o que faltava.
   Movimento fica em css/zefra-motion.css. */

/* ============================================================ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 var(--text-base) / var(--leading-normal) var(--font-ui);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.015em; line-height: var(--leading-snug); margin: 0; text-wrap: balance; }
p { margin: 0; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
::selection { background: color-mix(in srgb, var(--brand) 25%, transparent); }
img, svg { max-width: 100%; }
code, kbd, samp { font-family: var(--font-mono); font-size: 0.92em; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
/* unidades técnicas (dB(A), mg/m³) nunca mudam de caixa, mesmo dentro de rótulos em maiúsculas */
.un { text-transform: none !important; letter-spacing: 0 !important; }
.num, td.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
/* identificadores (CNPJ, CPF, CA, datas, códigos): mono, alinhados à esquerda */
.cod, td.cod { font-family: var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--text-soft); }
.faint { color: var(--text-faint); }

body:has(.dev-banner) { --banner-h: 1.9rem; }
.dev-banner {
  position: sticky; top: 0; z-index: var(--z-nav);
  height: 1.9rem; line-height: 1.9rem; padding-block: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  background: var(--side-bg); color: var(--side-text-soft);
  font: 500 var(--text-xs) / 1.9rem var(--font-mono); letter-spacing: 0.03em; text-align: center; padding-inline: 0.75rem;
}

/* ============================================================ ícones (sprite Lucide) */
.zi {
  width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.2em;
  fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
}
.zi-lg { width: 1.5em; height: 1.5em; }

/* ============================================================ marca */
.zefra-mark { width: 1.9rem; height: auto; flex: none; display: block; }
.zefra-mark .zm-body { fill: var(--logo-main); }
.zefra-mark .zm-top { fill: var(--logo-mid); }
.zefra-mark .zm-base { fill: var(--logo-acc); }
.on-dark .zefra-mark, .sidebar .zefra-mark, .auth-hero .zefra-mark {
  --logo-main: var(--logo-main-dk); --logo-mid: var(--logo-mid-dk); --logo-acc: var(--logo-acc-dk);
}
.logo { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; }
.logo:hover { text-decoration: none; }
.logo-word { font-family: var(--font-display); font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; font-size: 1.02rem; line-height: 1; }
.logo-product { font-family: var(--font-ui); font-weight: 500; font-size: 0.95rem; line-height: 1; opacity: 0.72; }

/* ============================================================ estrutura do app */
.app-shell { display: flex; min-height: calc(100vh - var(--banner-h)); align-items: stretch; }
.main-content { flex: 1; min-width: 0; }

.sidebar {
  width: var(--sidebar-w); flex: none; display: flex; flex-direction: column;
  background: var(--side-bg); color: var(--side-text);
  padding: var(--space-5) var(--space-3); position: sticky; top: var(--banner-h); height: calc(100vh - var(--banner-h)); overflow-y: auto;
  --logo-main: var(--logo-main-dk); --logo-mid: var(--logo-mid-dk); --logo-acc: var(--logo-acc-dk);
}
.sidebar .logo { color: var(--side-text); padding: 0.15rem 0.6rem 1.5rem; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar .nav-label { font: 600 var(--text-xs) / 1 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--side-text-soft); padding: 0.9rem 0.7rem 0.4rem; opacity: 0.85; }
.sidebar nav a {
  position: relative; display: flex; align-items: center; gap: 0.65rem;
  color: var(--side-text-soft); font-size: var(--text-base); font-weight: 500;
  padding: 0.55rem 0.7rem; border-radius: var(--radius-sm);
  transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.sidebar nav a:hover { text-decoration: none; color: var(--side-text); background: var(--side-hover); }
.sidebar nav a.active { color: var(--side-text); background: var(--side-active); font-weight: 600; }
.sidebar nav a.active::before { content: ""; position: absolute; left: -0.75rem; top: 22%; bottom: 22%; width: 3px; border-radius: 0 3px 3px 0; background: var(--support); }
.sidebar-user {
  border-top: 1px solid var(--side-line); margin-top: var(--space-4); padding: var(--space-4) 0.7rem 0;
  font-size: var(--text-sm); color: var(--side-text-soft); line-height: 1.4;
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; word-break: break-word;
}
.sidebar .btn-ghost { color: var(--side-text); border-color: var(--side-line); }
.sidebar .btn-ghost:hover { background: var(--side-hover); border-color: var(--side-text-soft); }
.tenant-chip { display: flex; flex-direction: column; gap: 2px; margin-top: var(--space-4); padding: var(--space-3) 0.7rem 0; border-top: 1px solid var(--side-line); font-size: var(--text-xs); color: var(--side-text-soft); }
.tenant-chip b { color: var(--side-text); font-weight: 600; font-size: var(--text-sm); }

.topnav {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
  padding: 0.95rem 2rem; border-bottom: 1px solid var(--line); background: var(--surface);
}
.topnav .logo { color: var(--text); }
.topnav .logo .zefra-mark { width: 1.7rem; }

@media (max-width: 900px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); padding: var(--space-3) var(--space-4); overflow: visible; }
  .sidebar .logo { padding: 0; flex: 1; }
  .sidebar form { order: 2; margin: 0 !important; flex: none; }
  .sidebar nav { order: 3; flex: 1 1 100%; flex-direction: row; overflow-x: auto; gap: 4px; scrollbar-width: none; margin: 0 calc(var(--space-4) * -1); padding: 0 var(--space-4); }
  .sidebar nav::-webkit-scrollbar { display: none; }
  .sidebar nav a { white-space: nowrap; flex: none; }
  .sidebar nav a.active::before { display: none; }
  .sidebar .nav-label, .tenant-chip, .sidebar-user { display: none; }
  .sidebar .keep-mobile { display: flex !important; order: 2; flex: none; }
  .topnav { padding: 0.8rem 1rem; }
}

/* ============================================================ página */
.page { max-width: var(--content-max); margin: 0 auto; padding: var(--space-10) var(--space-6) 4.5rem; }
.page-narrow { max-width: 640px; }
.page-form { max-width: 900px; }
.page-head { margin-bottom: var(--space-8); display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; }
.page-head h1 { font-size: var(--text-2xl); margin: 0 0 0.3rem; }
.page-head p { color: var(--text-soft); font-size: var(--text-base); }
.breadcrumb { display: flex; flex-wrap: wrap; gap: 0.35rem; list-style: none; padding: 0; margin: 0 0 var(--space-3); font: 500 var(--text-xs) / 1.4 var(--font-mono); color: var(--text-soft); }
.breadcrumb li + li::before { content: "/"; margin-right: 0.35rem; color: var(--text-faint); }
.breadcrumb a { color: var(--text-soft); }
@media (max-width: 640px) { .page { padding: var(--space-6) var(--space-4) 3.5rem; } .page-head h1 { font-size: var(--text-xl); } }

/* ============================================================ cartões */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1); margin-bottom: var(--space-6);
}
.card-head { padding: 1.1rem 1.4rem 0.95rem; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; }
.card-head h2 { font-size: var(--text-md); margin: 0; }
.card-head p { margin: 0.25rem 0 0; font-size: var(--text-sm); color: var(--text-soft); }
.card-body { padding: 1.3rem 1.4rem; }
.card-foot { padding: 0.9rem 1.4rem; border-top: 1px solid var(--line); background: var(--surface-sunken); border-radius: 0 0 var(--radius-lg) var(--radius-lg); display: flex; gap: var(--space-3); justify-content: flex-end; }
.card > .table-wrap:last-child table tr:last-child td { border-bottom: 0; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--space-4); margin-bottom: var(--space-6); }
.stat-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-1); padding: 1.1rem 1.25rem; display: flex; flex-direction: column; gap: 0.35rem; }
.stat-card .stat-label { font: 500 var(--text-xs) / 1.3 var(--font-mono); letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-soft); }
.stat-card .stat-value { font: 700 var(--text-xl) / 1.1 var(--font-display); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.stat-card .stat-value small { font: 500 var(--text-sm) var(--font-ui); color: var(--text-soft); margin-left: 0.25rem; letter-spacing: 0; }
.stat-card .stat-note { font-size: var(--text-sm); color: var(--text-soft); }

.entidade-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--space-4); margin-top: var(--space-4); }
.entidade-card {
  display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 1.15rem 1.3rem; color: var(--text); box-shadow: var(--shadow-1);
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.entidade-card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: var(--brand); }
.entidade-card h3 { font-size: var(--text-md); margin: 0 0 0.25rem; }
.entidade-card .sub { font-size: var(--text-sm); color: var(--text-soft); margin: 0 0 0.7rem; }

.kv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.9rem 1.6rem; margin-bottom: 0.6rem; }
.kv { display: flex; flex-direction: column; gap: 0.15rem; }
.kv-label { font: 500 var(--text-xs) / 1.3 var(--font-mono); letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-faint); }
.kv-value { font-size: var(--text-base); color: var(--text); }

/* ============================================================ botões */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  border: 1.5px solid transparent; border-radius: var(--radius-md); padding: 0.62rem 1.2rem;
  font: 600 var(--text-base) / 1.2 var(--font-ui); cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out), transform var(--dur-instant) var(--ease-out);
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: var(--on-brand); }
.btn-primary:hover { background: var(--brand-hover); }
.btn-primary:active { background: var(--brand-press); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--surface-sunken); border-color: var(--text-faint); }
.btn-soft { background: var(--brand-soft); color: var(--brand-soft-text); }
.btn-soft:hover { background: color-mix(in srgb, var(--brand-soft) 78%, var(--brand)); }
.btn-danger { background: var(--danger-bg); color: var(--danger-text); }
.btn-danger:hover { background: color-mix(in srgb, var(--danger-bg) 70%, var(--danger-solid)); }
.btn-sm { padding: 0.4rem 0.85rem; font-size: var(--text-sm); border-radius: var(--radius-sm); }
.btn-lg { padding: 0.8rem 1.6rem; font-size: var(--text-md); }
.btn-block { width: 100%; }
.btn-icon { padding: 0.55rem; aspect-ratio: 1; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; pointer-events: none; }
.btn[aria-busy="true"] { position: relative; color: transparent !important; pointer-events: none; }
.btn[aria-busy="true"]::after {
  content: ""; position: absolute; width: 1.05em; height: 1.05em; border-radius: 50%;
  border: 2px solid var(--spin, var(--on-brand)); border-right-color: transparent; animation: z-spin 0.7s linear infinite;
}
.btn-ghost[aria-busy="true"], .btn-soft[aria-busy="true"], .btn-danger[aria-busy="true"] { --spin: var(--text); }
.link-button { background: none; border: none; padding: 0; color: var(--brand); font: 500 var(--text-sm) var(--font-ui); cursor: pointer; }
.link-button:hover { text-decoration: underline; }
.acoes { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: var(--space-4); }
@media (max-width: 640px) { .btn-primary[type="submit"] { width: 100%; padding: 0.85rem 1.25rem; font-size: var(--text-md); } }

/* ============================================================ formulários */
.field { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: var(--space-4); }
.field label { font-size: var(--text-sm); color: var(--text-soft); font-weight: 600; }
.field input[type=text], .field input[type=date], .field input[type=email], .field input[type=number],
.field input[type=password], .field input[type=tel], .field input[type=search], .field input[type=url], .field input[type=time],
.field input[type=file], .field select, .field textarea, .input {
  width: 100%; min-height: 2.75rem; border: 1.5px solid var(--line-strong); border-radius: var(--radius-md);
  padding: 0.6rem 0.8rem; font: 400 1rem / 1.4 var(--font-ui); background: var(--surface); color: var(--text);
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
/* 1rem (16px) nos campos evita o zoom automático do Safari/iOS ao focar. */
.field input::placeholder, .field textarea::placeholder { color: var(--text-faint); opacity: 0.8; }
.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--text-faint); }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent);
}
.field select {
  appearance: none; -webkit-appearance: none; padding-right: 2.4rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238A94B8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.75rem center; background-size: 1.1rem;
}
.field textarea { min-height: 5.5rem; resize: vertical; }
.field input[type=file] { padding: 0.4rem; }
.field input[type=file]::file-selector-button { margin-right: 0.75rem; border: 0; border-radius: var(--radius-sm); padding: 0.45rem 0.85rem; background: var(--brand-soft); color: var(--brand-soft-text); font: 600 var(--text-sm) var(--font-ui); cursor: pointer; }
.field input[type=file]::file-selector-button:hover { background: color-mix(in srgb, var(--brand-soft) 78%, var(--brand)); }
.field input:disabled, .field select:disabled, .field textarea:disabled { background: var(--surface-sunken); color: var(--text-faint); cursor: not-allowed; }
.field [aria-invalid="true"] { border-color: var(--danger-solid); }
.field [aria-invalid="true"]:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger-solid) 22%, transparent); }
.hint, .field .hint { font-size: var(--text-xs); color: var(--text-faint); }
.field .field-error { font-size: var(--text-xs); color: var(--danger-text); font-weight: 600; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 var(--space-4); }
.field-check { display: flex; align-items: center; gap: 0.5rem; font-size: var(--text-base); margin-bottom: 0.9rem; }
.field-check input { width: auto; min-height: 0; accent-color: var(--brand); }
input[type=checkbox], input[type=radio] { accent-color: var(--brand); }
.form-subtitulo { font: 600 var(--text-xs) / 1.3 var(--font-mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); margin: var(--space-4) 0 0.6rem; padding-top: 0.9rem; border-top: 1px dashed var(--line-strong); }
.form-mais { margin: 0.4rem 0 1rem; }
.form-mais summary { cursor: pointer; color: var(--brand); font-size: var(--text-sm); font-weight: 600; padding: 0.3rem 0; }
.form-mais .field-row { margin-top: 0.7rem; }
.linhas-repetidas { display: flex; flex-direction: column; gap: 0.6rem; margin-bottom: 0.6rem; }
.linha-repetida { display: flex; flex-wrap: wrap; gap: 0.7rem; align-items: flex-end; background: var(--surface-sunken); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 0.8rem 0.9rem; }
.linha-repetida .field { margin-bottom: 0; flex: 1 1 160px; min-width: 0; }
.linha-repetida .field label { font-size: var(--text-xs); }
.linha-remover { align-self: flex-end; flex: none; }

/* ============================================================ tabelas */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: var(--text-base); }
th, td { text-align: left; padding: 0.75rem 1.1rem; border-bottom: 1px solid var(--line); }
th { font: 600 0.68rem / 1.3 var(--font-mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-soft); white-space: nowrap; background: var(--surface-sunken); }
th.num, td.num { text-align: right; }
tbody tr { transition: background-color var(--dur-instant) var(--ease-out); }
tbody tr:hover { background: color-mix(in srgb, var(--brand) 5%, transparent); }
tr:last-child td { border-bottom: none; }
.card > .table-wrap:first-child thead th:first-child { border-top-left-radius: var(--radius-lg); }
.card > .table-wrap:first-child thead th:last-child { border-top-right-radius: var(--radius-lg); }

/* ============================================================ status, avisos, feedback */
.pill { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.18rem 0.65rem; border-radius: var(--radius-pill); font: 600 var(--text-xs) / 1.4 var(--font-ui); white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok { background: var(--ok-bg); color: var(--ok-text); }
.pill.warn { background: var(--warn-bg); color: var(--warn-text); }
.pill.danger, .pill.erro { background: var(--danger-bg); color: var(--danger-text); }
.pill.info { background: var(--info-bg); color: var(--info-text); }
.pill.neutro { background: var(--brand-soft); color: var(--brand-soft-text); }
.badge { display: inline-grid; place-items: center; min-width: 1.25rem; height: 1.25rem; padding: 0 0.35rem; border-radius: var(--radius-pill); background: var(--brand); color: var(--on-brand); font: 700 0.68rem / 1 var(--font-ui); }
.tag { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.15rem 0.5rem; border-radius: 6px; background: var(--surface-sunken); border: 1px solid var(--line); color: var(--text-soft); font: 500 var(--text-xs) var(--font-mono); }

.alert { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: flex-start; padding: 0.75rem 0.95rem; border-radius: var(--radius-md); font-size: var(--text-sm); margin: 0 0 var(--space-4); border: 1px solid transparent; }
/* conteúdo solto (texto + <strong> + <br>, sem <span> ao redor) vira vários itens flex — sem quebra, estoura em telas estreitas */
.alert-ok { background: var(--ok-bg); color: var(--ok-text); border-color: color-mix(in srgb, var(--ok-solid) 30%, transparent); }
.alert-erro, .alert-danger { background: var(--danger-bg); color: var(--danger-text); border-color: color-mix(in srgb, var(--danger-solid) 30%, transparent); }
.alert-warn { background: var(--warn-bg); color: var(--warn-text); border-color: color-mix(in srgb, var(--warn-solid) 35%, transparent); }
.alert-info { background: var(--info-bg); color: var(--info-text); border-color: color-mix(in srgb, var(--info-solid) 30%, transparent); }

.toast-region { position: fixed; right: var(--space-4); bottom: var(--space-4); display: flex; flex-direction: column; gap: 0.5rem; z-index: var(--z-toast); width: min(92vw, 380px); pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: flex-start; gap: 0.65rem; padding: 0.8rem 0.95rem;
  background: var(--surface-raised); color: var(--text); border: 1px solid var(--line); border-left: 4px solid var(--brand);
  border-radius: var(--radius-md); box-shadow: var(--shadow-3); font-size: var(--text-sm);
}
.toast[data-tipo="ok"] { border-left-color: var(--ok-solid); }
.toast[data-tipo="erro"] { border-left-color: var(--danger-solid); }
.toast[data-tipo="aviso"] { border-left-color: var(--warn-solid); }
.toast[data-tipo="info"] { border-left-color: var(--info-solid); }
.toast .toast-close { margin-left: auto; background: none; border: 0; color: var(--text-faint); cursor: pointer; padding: 0 0.15rem; font-size: 1.1rem; line-height: 1; }

.spinner { width: 1.25rem; height: 1.25rem; border: 2.5px solid var(--line-strong); border-top-color: var(--brand); border-radius: 50%; display: inline-block; animation: z-spin 0.8s linear infinite; }
.skeleton { background: linear-gradient(90deg, var(--surface-sunken) 0%, var(--line) 50%, var(--surface-sunken) 100%); background-size: 200% 100%; border-radius: var(--radius-sm); color: transparent; animation: z-shimmer 1.3s linear infinite; }
.skeleton-line { height: 0.9rem; margin: 0.45rem 0; }
.skeleton-block { height: 5rem; border-radius: var(--radius-md); }
.progress { height: 8px; border-radius: var(--radius-pill); background: var(--surface-sunken); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--support); transition: width var(--dur-slow) var(--ease-out); }
.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 0.5rem; padding: var(--space-12) var(--space-6); color: var(--text-soft); }
.empty-state .illus { width: 148px; height: auto; margin-bottom: 0.4rem; }
.empty-state h3 { color: var(--text); font-size: var(--text-md); }
.empty-state p { max-width: 42ch; font-size: var(--text-sm); }
.empty-state .btn { margin-top: 0.6rem; }

/* ============================================================ sobreposições e navegação interna */
dialog.modal { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 0; width: min(92vw, 520px); background: var(--surface-raised); color: var(--text); box-shadow: var(--shadow-3); }
dialog.modal::backdrop { background: var(--overlay); backdrop-filter: blur(2px); }
.modal-head { padding: 1.1rem 1.4rem 0.6rem; display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); }
.modal-head h2 { font-size: var(--text-lg); }
.modal-body { padding: 0.4rem 1.4rem 1.2rem; color: var(--text-soft); }
.modal-foot { padding: 0.9rem 1.4rem; border-top: 1px solid var(--line); background: var(--surface-sunken); border-radius: 0 0 var(--radius-lg) var(--radius-lg); display: flex; gap: var(--space-3); justify-content: flex-end; flex-wrap: wrap; }

.dropdown { position: relative; display: inline-block; }
.menu { position: absolute; right: 0; top: calc(100% + 0.35rem); min-width: 210px; background: var(--surface-raised); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow-2); padding: 0.35rem; z-index: var(--z-dropdown); display: none; }
.dropdown[data-open="true"] .menu { display: block; }
.menu a, .menu button { display: flex; align-items: center; gap: 0.6rem; width: 100%; padding: 0.5rem 0.65rem; border-radius: 8px; color: var(--text); background: none; border: 0; font: 500 var(--text-base) var(--font-ui); cursor: pointer; text-align: left; text-decoration: none; }
.menu a:hover, .menu button:hover { background: var(--surface-sunken); text-decoration: none; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 0.3rem 0; }

[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 6px); transform: translateX(-50%);
  background: var(--text); color: var(--bg); font: 500 var(--text-xs) / 1.3 var(--font-ui); padding: 0.3rem 0.55rem; border-radius: 6px;
  white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity var(--dur-fast) var(--ease-out); z-index: var(--z-dropdown);
}
[data-tip]:hover::after, [data-tip]:focus-visible::after { opacity: 1; }

.tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--line); overflow-x: auto; margin-bottom: var(--space-5); }
.tab { padding: 0.6rem 0.95rem; border: 0; background: none; color: var(--text-soft); font: 600 var(--text-base) var(--font-ui); border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--brand); border-bottom-color: var(--brand); }
.tab-panel[hidden] { display: none; }

.stepper { display: flex; gap: 0.5rem; list-style: none; padding: 0; margin: 0 0 var(--space-6); counter-reset: passo; flex-wrap: wrap; }
.stepper li { counter-increment: passo; display: flex; align-items: center; gap: 0.5rem; font-size: var(--text-sm); color: var(--text-soft); font-weight: 600; }
.stepper li::before { content: counter(passo); display: grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 50%; border: 1.5px solid var(--line-strong); font: 600 var(--text-xs) var(--font-mono); color: var(--text-soft); background: var(--surface); }
.stepper li + li::after { content: none; }
.stepper li[aria-current="step"] { color: var(--text); }
.stepper li[aria-current="step"]::before { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.stepper li.feito::before { content: "✓"; background: var(--support); color: var(--on-support); border-color: var(--support); }

.avatar { width: 2rem; height: 2rem; border-radius: 50%; display: inline-grid; place-items: center; background: var(--brand-soft); color: var(--brand-soft-text); font: 700 0.8rem var(--font-display); flex: none; }

/* ============================================================ autenticação */
.auth-shell { min-height: calc(100vh - var(--banner-h)); display: flex; align-items: center; justify-content: center; padding: var(--space-8); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-2); padding: 2.2rem; }
.auth-card h1 { font-size: var(--text-xl); margin: 0 0 0.3rem; }
.auth-card p.sub { color: var(--text-soft); font-size: var(--text-sm); margin: 0 0 var(--space-6); }
.auth-card .btn-primary { width: 100%; margin-top: 0.4rem; }
.auth-card .auth-foot { margin-top: var(--space-5); padding-top: var(--space-4); border-top: 1px solid var(--line); font-size: var(--text-xs); color: var(--text-faint); }

.auth-split { padding: 0; align-items: stretch; justify-content: stretch; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.auth-hero {
  position: relative; overflow: hidden; background: var(--side-bg); color: var(--side-text);
  display: flex; flex-direction: column; justify-content: space-between; padding: var(--space-10);
  --logo-main: var(--logo-main-dk); --logo-mid: var(--logo-mid-dk); --logo-acc: var(--logo-acc-dk);
}
.auth-hero::before {
  content: ""; position: absolute; right: 7%; bottom: 9%; width: 42%; aspect-ratio: 44 / 46; opacity: 0.07;
  background: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 44 46'%3E%3Cpath fill='%23fff' d='M0 0h44v12L21 34h23v12H0V34l23-22H0z'/%3E%3C/svg%3E");
}
.auth-hero .logo { color: var(--side-text); position: relative; }
.auth-hero .logo .zefra-mark { width: 2.2rem; }
.auth-hero h2 { position: relative; font-size: clamp(1.6rem, 2.6vw, 2.3rem); line-height: 1.12; max-width: 16ch; margin-bottom: 0.9rem; letter-spacing: -0.02em; color: var(--side-text); }
.auth-hero p { position: relative; color: var(--side-text-soft); max-width: 38ch; font-size: var(--text-base); }
.auth-hero .auth-hero-foot { position: relative; font: 500 var(--text-xs) var(--font-mono); letter-spacing: 0.04em; color: var(--side-text-soft); }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: var(--space-8); background: var(--bg); }
.auth-split .auth-card { box-shadow: none; border: 0; background: transparent; padding: 0; }
@media (max-width: 900px) {
  .auth-split { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .auth-hero { padding: var(--space-6); gap: var(--space-4); }
  .auth-hero::before { display: none; }
  .auth-hero h2, .auth-hero p, .auth-hero .auth-hero-foot { display: none; }
  .auth-panel { padding: var(--space-6) var(--space-4) var(--space-10); align-items: flex-start; }
}

/* ============================================================ portal do funcionário (mobile-first) */
.portal-shell { max-width: 480px; margin: 0 auto; padding: 1.2rem 1.1rem 4rem; }
.portal-header { display: flex; align-items: center; justify-content: space-between; padding: 0.6rem 0 1.2rem; }
.portal-lista { display: flex; flex-direction: column; gap: 0.7rem; }
.portal-item { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 0.95rem 1.1rem; color: var(--text); box-shadow: var(--shadow-1); transition: border-color var(--dur-fast) var(--ease-out); }
.portal-item:hover { text-decoration: none; border-color: var(--brand); }
.portal-item-titulo { font-weight: 600; font-size: var(--text-base); }
.portal-item-sub { font-size: var(--text-sm); color: var(--text-soft); margin-top: 0.2rem; }
.portal-vazio { font-size: var(--text-sm); color: var(--text-faint); padding: 1rem 0; }

.campo-secao { margin-bottom: var(--space-6); }
.campo-secao-titulo { font: 600 0.68rem / 1.3 var(--font-mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-soft); margin: 0 0 0.8rem; }
.campo-assinatura-caixa { border: 1.5px dashed var(--line-strong); border-radius: var(--radius-md); background: var(--surface); touch-action: none; width: 100%; height: 160px; display: block; }
.campo-assinatura-legenda { font-size: var(--text-xs); color: var(--text-faint); margin: 0.4rem 0 0.9rem; }
.declaracao-texto { white-space: pre-line; font-size: var(--text-base); color: var(--text-soft); background: var(--surface-sunken); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 1rem 1.2rem; margin-bottom: 1.2rem; }
.link-copia { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.link-copia code { background: var(--surface-sunken); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0.5rem 0.7rem; font-size: var(--text-sm); word-break: break-all; }

/* ============================================================ utilitários mínimos */
.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--space-4); }
.hide-mobile { }
@media (max-width: 640px) { .hide-mobile { display: none !important; } }
[hidden] { display: none !important; }
