@import url('/static/fonts.css');
/* Consulta de Empresas Staffia: tokens (primitivo → semântico → componente). Identidade: ardósia #283838 e ciano
   #00adee; texto e ações usam tons escuros do ciano (#006b91) para contraste AA. Tema escuro segue o sistema. */
:root {
  --slate-900: #1c2828; --slate-800: #283838; --slate-700: #3a4d4f; --slate-500: #5b7177; --slate-300: #b9cbd2;
  --slate-200: #dce8eb; --slate-100: #eef4f6; --slate-50: #f4f8f9;
  --cyan-500: #00adee; --cyan-700: #006b91; --cyan-800: #005677; --cyan-100: #e4f2f6; --cyan-50: #f0f9fc;
  --green-700: #1f6e46; --green-100: #e3f4ea; --amber-800: #7a4f00; --amber-100: #fff1d7; --amber-600: #c88b24;
  --red-700: #a3231b; --red-100: #fdecec; --white: #fff;

  --bg: var(--slate-50); --surface: var(--white); --surface-2: var(--slate-100); --text: var(--slate-800);
  --text-muted: #4f666c; --border: var(--slate-200); --border-strong: var(--slate-300);
  --primary: var(--cyan-700); --primary-hover: var(--cyan-800); --on-primary: var(--white);
  --secondary-bg: var(--cyan-100); --secondary-text: var(--slate-800); --link: var(--cyan-700);
  --focus: var(--cyan-500); --header-bg: var(--slate-800); --header-text: #d6e7eb; --header-accent: #b7eafa;
  --ok-bg: var(--green-100); --ok-text: var(--green-700); --warn-bg: var(--amber-100); --warn-text: var(--amber-800);
  --warn-border: var(--amber-600); --danger-bg: var(--red-100); --danger-text: var(--red-700);
  --info-bg: var(--cyan-50); --info-text: var(--cyan-800);
  --radius-sm: 6px; --radius: 10px; --radius-lg: 16px; --shadow: 0 8px 28px #2838380c;
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 24px; --space-6: 32px; --space-7: 48px;
  --font: Ubuntu, "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --text-xs: 12px; --text-sm: 13px; --text-base: 15px; --text-md: 16px; --text-lg: 19px; --text-xl: clamp(26px, 3.6vw, 38px);
  --ease: cubic-bezier(.2, .7, .2, 1); --dur-fast: 120ms; --dur: 200ms;
  --sidebar-width: 248px; --nav-active-bg: var(--cyan-50); --nav-active-text: var(--cyan-800); --nav-active-icon: var(--cyan-700);
  --nav-indicator: var(--cyan-500); --backdrop: #1c282866; --drawer-shadow: 0 0 40px #1c28283d;
  /* Gráficos: série única validada (dataviz) contra a superfície clara e a escura. */
  --chart-1: var(--cyan-700); --chart-track: var(--slate-100);
  --mono: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121a1b; --surface: #1a2526; --surface-2: #213031; --text: #e3eef0; --text-muted: #a5bcc2;
    --border: #2f4244; --border-strong: #4a6265; --primary: #4cc3f0; --primary-hover: #7dd3f4; --on-primary: #08212b;
    --secondary-bg: #24393d; --secondary-text: #e3eef0; --link: #6fd0f5; --header-bg: #0d1415;
    --ok-bg: #173826; --ok-text: #8fdcae; --warn-bg: #3b2d0f; --warn-text: #f3cf86; --warn-border: #c88b24;
    --danger-bg: #401a18; --danger-text: #f6a8a2; --info-bg: #15303a; --info-text: #9fdcf5; --shadow: none;
    --nav-active-bg: #15303a; --nav-active-text: #9fdcf5; --nav-active-icon: #6fd0f5; --backdrop: #000000a6; --drawer-shadow: 0 0 40px #0009;
    --chart-1: #1f9fd1; --chart-track: #24393d;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { font-family: var(--font); color: var(--text); background: var(--bg); line-height: 1.55; font-size: 15px;
  -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
img { max-width: 100%; }
a { color: var(--link); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
h1 { font-size: clamp(26px, 3.6vw, 38px); line-height: 1.15; letter-spacing: -0.8px; margin: 6px 0 12px; }
h2 { font-size: 19px; line-height: 1.3; margin: 0 0 var(--space-4); }
h3 { font-size: 16px; margin: 0 0 var(--space-3); }
h4 { font-size: 14px; margin: var(--space-5) 0 var(--space-2); }
p { margin: 0 0 var(--space-3); }
code, kbd, .mono { font-family: var(--mono); font-size: .92em; }
kbd { border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; font-size: 12px;
  background: var(--surface); color: var(--text); }
small, .hint, .muted { color: var(--text-muted); }
small { display: block; font-size: 13px; }
.hint { font-size: 13px; }
.lead { font-size: 16px; color: var(--text-muted); max-width: 70ch; }
.eyebrow { text-transform: uppercase; font-weight: 700; letter-spacing: 1.6px; color: var(--link); font-size: 12px; margin: 0; }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.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; }

/* Casca: menu lateral claro (brand/mockup-menu-lateral.html), barra superior fina e rodapé. */
.skip-link { position: absolute; left: var(--space-4); top: -60px; z-index: 40; background: var(--surface); color: var(--link);
  padding: var(--space-2) var(--space-4); border-radius: var(--radius-sm); font-weight: 600; }
.skip-link:focus { top: var(--space-2); }
body.app { display: block; }
.shell { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); min-height: 100vh;
  /* A coluna do menu mantém fundo e borda em páginas longas (o menu em si é fixo na tela). */
  background: linear-gradient(90deg, var(--surface) calc(var(--sidebar-width) - 1px), var(--border) 0 var(--sidebar-width), transparent 0); }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: var(--space-2);
  background: var(--surface); border-right: 1px solid var(--border); padding: 20px 14px 14px; z-index: 30; }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.sidebar-logo { display: block; padding: 4px 10px 16px; border-radius: var(--radius-sm); }
.sidebar-logo img { display: block; width: 168px; height: auto; }
/* Logo por tema: mesma especificidade nas duas regras, maior que a de `.sidebar-logo img`. */
.sidebar-logo .logo-on-dark { display: none; }
@media (prefers-color-scheme: dark) { .sidebar-logo .logo-on-light { display: none; } .sidebar-logo .logo-on-dark { display: block; } }
.side-nav { margin-bottom: var(--space-3); }
.nav-label { font-size: 11px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; color: var(--text-muted);
  padding: 14px 12px 6px; margin: 0; }
.side-nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 9px 12px; border-radius: var(--radius);
  color: var(--text); text-decoration: none; font-size: 14px; font-weight: 500; position: relative;
  transition: background var(--dur-fast) var(--ease); }
.nav-item:hover { background: var(--surface-2); text-decoration: none; }
.nav-item[aria-current=page] { background: var(--nav-active-bg); color: var(--nav-active-text); font-weight: 700; }
.nav-item[aria-current=page] .icon { color: var(--nav-active-icon); }
.nav-item[aria-current=page]::before { content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 4px;
  border-radius: 0 4px 4px 0; background: var(--nav-indicator); }
.icon { width: 19px; height: 19px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round;
  stroke-linejoin: round; }
.nav-item .icon { color: var(--text-muted); }
.side-quota { margin: auto 4px 0; padding: 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.side-quota-title { font-size: 12px; font-weight: 700; margin: 0 0 8px; }
.side-quota .meter { height: 6px; background: var(--border); }
.side-quota .meter span { background: var(--nav-indicator); min-width: 4px; }
.side-quota .meter-warn span { background: var(--warn-border); }
.side-quota small { margin-top: 8px; font-size: 12px; }
.me { display: flex; align-items: center; gap: 6px; padding: 8px; border-radius: 12px; border: 1px solid var(--border); margin-top: auto; }
.side-quota + .me { margin-top: var(--space-2); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--slate-800); color: #fff; display: grid; place-items: center;
  font-weight: 700; font-size: 13px; flex: none; }
.me-text { min-width: 0; flex: 1; line-height: 1.25; font-size: 13px; font-weight: 500; }
.me-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me small { font-size: 11px; }
.me form { margin: 0; }
.icon-button { display: inline-grid; place-items: center; width: 44px; height: 44px; min-height: 44px; padding: 0; flex: none;
  border-radius: var(--radius); background: transparent; color: var(--text-muted); border: 1px solid transparent; }
.icon-button:hover { background: var(--surface-2); color: var(--text); }
.icon-button[aria-current=page] { background: var(--nav-active-bg); color: var(--nav-active-text); }
.shell-main { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.topbar { display: flex; align-items: center; gap: var(--space-4); flex-wrap: wrap; padding: 12px 40px; min-height: 57px;
  border-bottom: 1px solid var(--border); background: var(--surface); }
.topbar-crumbs { flex: 1 1 auto; min-width: 0; }
.topbar .breadcrumbs ol { margin: 0; }
.topbar-base { margin: 0 0 0 auto; font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok-text); flex: none; }
.dot-warn { background: var(--warn-border); }
.menu-button { display: none; min-height: 44px; padding: 8px 14px; }
.menu-button .icon { width: 18px; height: 18px; }
.sidebar-close { display: none; }
.content { width: 100%; max-width: 1160px; margin: 0 auto; padding: 32px 40px var(--space-7); flex: 1; }
main:focus { outline: none; }
.nav-backdrop { display: none; }
/* Visitantes (login, convite, erro, documentação pública): só logo e ações, sem menu lateral. */
.visitor-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.visitor-inner { max-width: 1240px; margin: 0 auto; padding: 14px 24px; display: flex; align-items: center; gap: var(--space-5); flex-wrap: wrap; }
.visitor-inner .sidebar-logo { padding: 4px 0; }
.visitor-content { max-width: 1240px; padding-left: 24px; padding-right: 24px; }
.tagline { margin-left: auto; font-size: 13px; color: var(--text-muted); }
.site-footer { border-top: 1px solid var(--border); color: var(--text-muted); font-size: 12px; }
.site-footer p { max-width: 1240px; margin: 0 auto; padding: 4px 24px; }
.app .site-footer p { max-width: 1160px; padding-left: 40px; padding-right: 40px; }
.site-footer p:first-child { padding-top: var(--space-5); }
.site-footer p:last-child { padding-bottom: var(--space-5); }

.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 4px; padding: 0; margin: 0 0 var(--space-4); font-size: 13px; }
.breadcrumbs li + li::before { content: "/"; margin-right: 4px; color: var(--text-muted); }
.breadcrumbs [aria-current] { color: var(--text-muted); }
.subnav ul { list-style: none; display: flex; flex-wrap: wrap; gap: var(--space-2); padding: 0; margin: 0 0 var(--space-5); }
.subnav a { display: inline-block; padding: 6px 12px; border-radius: 999px; background: var(--secondary-bg); color: var(--secondary-text);
  text-decoration: none; font-size: 13px; font-weight: 600; }

/* Layout */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--space-5); flex-wrap: wrap;
  margin-bottom: var(--space-5); }
.page-head > div:first-child { flex: 1 1 380px; }
.head-actions, .button-row, .form-actions, .action-list { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }
.form-actions { margin-top: var(--space-4); }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-3); flex-wrap: wrap;
  margin-bottom: var(--space-3); }
.section-head h2 { margin: 0; }
.card { background: var(--surface); padding: var(--space-5); border: 1px solid var(--border); border-radius: var(--radius-lg);
  margin-bottom: var(--space-5); box-shadow: var(--shadow); }
.panel { border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-4); background: var(--surface); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: var(--space-4); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: var(--space-5); margin-bottom: var(--space-5); }
.narrow { max-width: 520px; margin: var(--space-6) auto; }
.narrow.wide-ish { max-width: 720px; }
.narrow .card { margin-top: var(--space-5); }

/* Botões */
button, .button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px;
  background: var(--primary); color: var(--on-primary); border: 1px solid transparent; padding: 10px 18px; font: inherit;
  font-weight: 650; border-radius: var(--radius-sm); cursor: pointer; text-decoration: none; line-height: 1.2; }
button:hover, .button:hover { background: var(--primary-hover); }
button.secondary, .button.secondary { background: var(--secondary-bg); color: var(--secondary-text); border-color: var(--border); }
button.secondary:hover, .button.secondary:hover { border-color: var(--border-strong); filter: brightness(.97); }
button.ghost, .button.ghost { background: transparent; color: var(--link); border-color: var(--border-strong); }
button.danger, .button.danger { background: var(--danger-bg); color: var(--danger-text); border-color: currentColor; }
button.small, .button.small { min-height: 36px; padding: 6px 12px; font-size: 13px; }
button.block { width: 100%; }
button[disabled] { opacity: .6; cursor: not-allowed; }
button[aria-busy=true]::before { content: ""; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: spin .8s linear infinite; }
.button-note { font-weight: 400; opacity: .85; font-size: 13px; }
.copy.copied { background: var(--ok-bg); color: var(--ok-text); }
.copy.copied::after { content: " ✓"; }

/* Formulários */
.field { margin-bottom: var(--space-4); min-width: 0; }
.field.inline { margin: 0; display: flex; align-items: center; gap: var(--space-2); }
.field.inline label { margin: 0; }
.field.inline select { width: auto; margin: 0; }
label, legend { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; }
fieldset { border: 0; padding: 0; margin: 0 0 var(--space-3); min-width: 0; }
legend { padding: 0; font-size: 14px; margin-bottom: var(--space-3); }
input, select, textarea { display: block; width: 100%; min-height: 44px; padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); font: inherit; color: var(--text); }
textarea { resize: vertical; font-family: var(--mono); font-size: 14px; }
input::placeholder, textarea::placeholder { color: #5f757b; opacity: 1; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
input[aria-invalid=true] { border-color: var(--danger-text); }
input[readonly] { background: var(--surface-2); }
.field small { margin-top: 4px; }
.field.check { display: flex; align-items: flex-start; gap: var(--space-2); margin-bottom: var(--space-2); }
.field.check input { width: 20px; height: 20px; min-height: 0; margin: 2px 0 0; flex: none; accent-color: var(--primary); }
.field.check label { font-weight: 400; font-size: 14px; margin: 0; }
.checks { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0 var(--space-3); }
.checks legend { grid-column: 1 / -1; }
.input-group { display: flex; gap: var(--space-2); align-items: stretch; }
.input-group input { flex: 1 1 220px; min-width: 0; }
.input-group button { flex: none; }
.inline-form { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.inline-form label { margin: 0; }
.inline-form select { width: auto; max-width: 100%; min-width: 0; }
details.more, details.refine { margin: var(--space-2) 0 var(--space-3); }
summary { cursor: pointer; font-weight: 600; color: var(--link); padding: var(--space-2) 0; }
summary:focus-visible { outline-offset: 4px; }
.quick-lookup { flex: 0 1 440px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: var(--space-4); box-shadow: var(--shadow); }
.quick-lookup label { display: flex; justify-content: space-between; align-items: center; }
.subform { margin-top: var(--space-4); padding-top: var(--space-4); border-top: 1px dashed var(--border-strong); }
.subform h4 { margin-top: 0; }
.subform small { margin-top: var(--space-2); }
.rules { list-style: none; padding: 0; margin: 0 0 var(--space-2); font-size: 13px; color: var(--text-muted); }
.rules li::before { content: "○ "; }
.rules li.ok { color: var(--ok-text); }
.rules li.ok::before { content: "● "; }
.rules-match { font-size: 13px; color: var(--warn-text); min-height: 1em; }
.rules-match.ok { color: var(--ok-text); }
.batch-counter { font-weight: 600; min-height: 1.5em; }
.batch-counter.warn { color: var(--warn-text); }
.cost { background: var(--info-bg); color: var(--text); border-radius: var(--radius); padding: var(--space-4); margin-bottom: var(--space-4); }
.cost p { margin-bottom: var(--space-2); }

/* Mensagens */
.notice { padding: 12px 16px; background: var(--info-bg); color: var(--text); border-left: 4px solid var(--primary);
  border-radius: var(--radius-sm); }
.notice.success { background: var(--ok-bg); border-left-color: var(--ok-text); }
.notice.warn { background: var(--warn-bg); border-left-color: var(--warn-border); }
.notice p:last-child, .notice ul:last-child { margin-bottom: 0; }
.form-error { padding: 12px 16px; background: var(--danger-bg); border-left: 4px solid var(--danger-text); border-radius: var(--radius-sm);
  color: var(--danger-text); font-weight: 600; margin: 0 0 var(--space-4); }
.empty { text-align: center; padding: var(--space-5) var(--space-3); color: var(--text-muted); }
.empty-title { font-weight: 700; color: var(--text); font-size: 16px; }

/* Selos, indicadores e estatísticas */
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 650; line-height: 1.6;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
.badge-ok { background: var(--ok-bg); color: var(--ok-text); border-color: transparent; }
.badge-warn { background: var(--warn-bg); color: var(--warn-text); border-color: transparent; }
.badge-danger { background: var(--danger-bg); color: var(--danger-text); border-color: transparent; }
.badge-info { background: var(--info-bg); color: var(--info-text); border-color: transparent; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: var(--space-4); margin-bottom: var(--space-5); }
.stats.compact { grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); }
.stats .card { margin: 0; }
.stat-label { font-size: 13px; font-weight: 600; color: var(--text-muted); margin: 0 0 4px; }
.stat-value { font-size: 30px; font-weight: 750; line-height: 1.15; margin: 0 0 var(--space-2); font-variant-numeric: tabular-nums; }
.stat-value span { font-size: 14px; font-weight: 500; color: var(--text-muted); }
.stat-detail { font-size: 13px; color: var(--text-muted); margin: var(--space-2) 0 0; }
.meter { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--primary); border-radius: inherit; }
.meter-warn span { background: var(--warn-border); }
.meter-0 { width: 0; } .meter-5 { width: 5%; } .meter-10 { width: 10%; } .meter-15 { width: 15%; } .meter-20 { width: 20%; }
.meter-25 { width: 25%; } .meter-30 { width: 30%; } .meter-35 { width: 35%; } .meter-40 { width: 40%; } .meter-45 { width: 45%; }
.meter-50 { width: 50%; } .meter-55 { width: 55%; } .meter-60 { width: 60%; } .meter-65 { width: 65%; } .meter-70 { width: 70%; }
.meter-75 { width: 75%; } .meter-80 { width: 80%; } .meter-85 { width: 85%; } .meter-90 { width: 90%; } .meter-95 { width: 95%; }
.meter-100 { width: 100%; }
progress { width: 100%; height: 10px; accent-color: var(--primary); }
.spinner { display: inline-block; width: 12px; height: 12px; border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -1px; margin-right: 4px; }
@keyframes spin { to { transform: rotate(360deg); } }
.count-result:empty { display: none; }
.count-result { margin-top: var(--space-3); padding: var(--space-3) var(--space-4); border-radius: var(--radius); background: var(--info-bg); }
.count-result.htmx-request { opacity: .6; }
.count-value { margin: 0; }
.count-value strong { font-size: 22px; }

/* Atalhos da página inicial */
.shortcuts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: var(--space-4); margin-bottom: var(--space-5); }
.shortcut { display: block; padding: var(--space-4) var(--space-5); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); text-decoration: none; color: var(--text); box-shadow: var(--shadow); }
.shortcut strong { display: block; color: var(--link); font-size: 16px; margin-bottom: 4px; }
.shortcut span { font-size: 13px; color: var(--text-muted); }
.shortcut:hover { border-color: var(--primary); }

/* Listas e tabelas */
.list { list-style: none; padding: 0; margin: 0 0 var(--space-3); }
.list > li { padding: var(--space-2) 0; border-bottom: 1px solid var(--border); }
.list > li:last-child { border-bottom: 0; }
.list.compact > li { padding: 4px 0; border: 0; }
.list.columns { columns: 3 220px; }
.list.people > li { display: flex; justify-content: space-between; gap: var(--space-3); align-items: center; flex-wrap: wrap; }
.person { font-weight: 600; overflow-wrap: anywhere; }
.row-actions { display: flex; align-items: center; gap: var(--space-2); }
.row-actions form { margin: 0; }
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0 0 var(--space-3); }
.chips li { background: var(--secondary-bg); color: var(--secondary-text); border-radius: 999px; padding: 3px 12px; font-size: 13px; }
.table-wrap { overflow-x: auto; }
.card.table-wrap { padding: 0; }
.data-table { border-collapse: collapse; width: 100%; text-align: left; font-size: 14px; }
.data-table th, .data-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.data-table thead th { font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--text-muted); background: var(--surface-2);
  position: sticky; top: 0; }
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table td small { font-size: 12px; }
.pagination { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; margin: var(--space-4) 0; }
.pagination form { margin: 0; }
.kv-list { margin: 0; }
.kv { display: grid; grid-template-columns: minmax(130px, 38%) 1fr; gap: var(--space-3); padding: 7px 0; border-bottom: 1px solid var(--border); }
.kv:last-child { border-bottom: 0; }
.kv dt { font-weight: 600; font-size: 13px; color: var(--text-muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.kv-list.inline { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 0 var(--space-5);
  margin-bottom: var(--space-4); }
.kv-list.inline .kv { grid-template-columns: 1fr; gap: 2px; }

/* Ficha */
.ficha-head { display: flex; justify-content: space-between; gap: var(--space-5); flex-wrap: wrap; }
.ficha-title { flex: 1 1 420px; }
.ficha-title h1 { margin-top: 4px; }
.ficha-id { flex: 0 1 320px; }
.ficha-id .label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; margin: 0; }
.ficha-id .cnpj { font-size: 22px; font-weight: 700; margin-bottom: var(--space-2); }
.ficha-id .actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.ficha-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 0 var(--space-5); }
.ficha-grid .wide { grid-column: 1 / -1; }
.action-list > div { flex: 1 1 260px; }
.action-list small { margin-top: 6px; }
.source { font-size: 13px; color: var(--text-muted); }

/* Tarefa, administração e API */
.status-card { border-left: 4px solid var(--primary); }
.status-card.status-ok { border-left-color: var(--ok-text); }
.status-card.status-warn { border-left-color: var(--warn-border); }
.status-card.status-danger { border-left-color: var(--danger-text); }
.status-card h2 { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }
details.client { padding: 0; }
details.client > summary { padding: var(--space-4) var(--space-5); color: var(--text); display: flex; flex-wrap: wrap; gap: var(--space-2);
  align-items: center; }
details.client > summary::marker { color: var(--link); }
.client-name { font-size: 17px; font-weight: 700; }
.client-body { padding: 0 var(--space-5) var(--space-5); border-top: 1px solid var(--border); padding-top: var(--space-5); }
.load-progress { background: var(--surface-2); border-radius: var(--radius); padding: var(--space-4); margin-bottom: var(--space-4); }
.secret-box input { font-size: 14px; }
.snippet { margin-bottom: var(--space-5); }
.snippet-head { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); margin-bottom: var(--space-2); }
.snippet-head h3 { margin: 0; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface-2); padding: var(--space-4); border-radius: var(--radius);
  margin: 0; font-size: 13px; border: 1px solid var(--border); }
.steps { padding-left: 20px; }
.steps li { margin-bottom: var(--space-2); }
.faq details { border-bottom: 1px solid var(--border); padding: var(--space-2) 0; }
.faq details:last-child { border-bottom: 0; }
.faq details p { margin: var(--space-2) 0 var(--space-3); max-width: 75ch; }
.auth h2 { font-size: 18px; }
.error-page .actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 28px 0 18px; }
.error-page code { font-size: 12px; overflow-wrap: anywhere; }

/* Gaveta do menu: até 900 px e nas páginas de documentação (que já têm índice próprio) o menu lateral sai de cena e
   abre pelo botão "Menu". Sem JavaScript ele fica empilhado no topo e continua acessível. */
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); background: none; }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--border); }
  .topbar, .content { padding-left: 20px; padding-right: 20px; }
  .app .site-footer p { padding-left: 20px; padding-right: 20px; }
}
.shell-drawer { grid-template-columns: minmax(0, 1fr); background: none; }
.shell-drawer .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--border); }
@media (max-width: 900px) {
  .js .menu-button { display: inline-flex; }
  .js .sidebar { position: fixed; inset: 0 auto 0 0; width: min(288px, 86vw); height: 100%; border-right: 1px solid var(--border);
    border-bottom: 0; transform: translateX(-100%); visibility: hidden;
    transition: transform var(--dur) var(--ease), visibility 0s linear var(--dur); }
  .js .sidebar-close { display: inline-grid; }
}
.js .shell-drawer .menu-button { display: inline-flex; }
.js .shell-drawer .sidebar { position: fixed; inset: 0 auto 0 0; width: min(288px, 86vw); height: 100%; border-right: 1px solid var(--border);
  border-bottom: 0; transform: translateX(-100%); visibility: hidden;
  transition: transform var(--dur) var(--ease), visibility 0s linear var(--dur); }
.js .shell-drawer .sidebar-close { display: inline-grid; }
.js .nav-open .sidebar { transform: none; visibility: visible; transition: transform var(--dur) var(--ease); box-shadow: var(--drawer-shadow); }
.js .nav-open .nav-backdrop { display: block; position: fixed; inset: 0; z-index: 25; background: var(--backdrop); }
@media (max-width: 720px) {
  .visitor-inner { padding: 12px 16px; }
  .visitor-content { padding-left: 16px; padding-right: 16px; }
  .topbar { gap: var(--space-2) var(--space-3); }
  .topbar-base { margin-left: 0; flex-basis: 100%; }
}

/* Telas estreitas: tabelas viram cartões */
@media (max-width: 720px) {
  .card { padding: var(--space-4); border-radius: var(--radius); }
  .tagline { display: none; }
  .quick-lookup { flex-basis: 100%; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .stat-value { font-size: 26px; }
  .client-body, details.client > summary { padding-left: var(--space-4); padding-right: var(--space-4); }
  .data-table.stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
  .data-table.stack, .data-table.stack tbody, .data-table.stack tr, .data-table.stack td { display: block; width: 100%; }
  .data-table.stack tr { padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border); }
  .data-table.stack td { border: 0; padding: 3px 0; overflow-wrap: anywhere; text-align: left; }
  .data-table.stack td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; font-weight: 600;
    text-transform: uppercase; letter-spacing: .3px; color: var(--text-muted); }
  .card.table-wrap { overflow: visible; }
  .input-group { flex-wrap: wrap; }
  .input-group button { flex: 1 1 auto; }
  .head-actions > * { flex: 1 1 auto; }
  .list.columns { columns: 1; }
}
/* Início (mockup do menu lateral): saudação com consulta rápida, três indicadores, atalhos com ícone e recentes. */
.hello { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--space-5); flex-wrap: wrap; margin-bottom: 28px; }
.hello > div:first-child { flex: 1 1 380px; }
.hello h1 { margin: 4px 0 6px; }
.hello .lead { margin: 0; }
.lookup { width: min(100%, 440px); }
.lookup-row { display: flex; gap: var(--space-2); align-items: stretch; }
.lookup-field { position: relative; flex: 1; min-width: 0; }
.lookup-field input { padding-right: 38px; }
.lookup-field kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); }
.lookup small { margin-top: 6px; font-size: 12px; }
.tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tiles .card { padding: 20px 22px; }
.shortcuts { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.shortcut { transition: border-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease); }
.shortcut:hover { border-color: var(--nav-indicator); transform: translateY(-1px); }
.shortcut-icon { width: 38px; height: 38px; border-radius: var(--radius); background: var(--nav-active-bg); color: var(--nav-active-icon);
  display: grid; place-items: center; margin-bottom: 12px; }
.shortcut-icon .icon { width: 20px; height: 20px; }
.recent { padding: 0; overflow: hidden; }
.recent-head { padding: 18px 22px 12px; margin: 0; }
.recent-head h2 { font-size: 17px; }
.recent .data-table th, .recent .data-table td { padding-left: 22px; padding-right: 22px; }
.recent-empty { padding: 0 22px 18px; }
@media (max-width: 1100px) { .shortcuts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) { .tiles { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 520px) { .shortcuts { grid-template-columns: minmax(0, 1fr); } .lookup { width: 100%; } .lookup-row { flex-wrap: wrap; } .lookup-field { flex-basis: 100%; } .lookup-row button { flex: 1 1 auto; } }
/* Gestão: abas, equipe, chaves, cadastro e painéis. */
.tabs ul { list-style: none; display: flex; flex-wrap: wrap; gap: 4px; padding: 0; margin: 0 0 var(--space-5); border-bottom: 1px solid var(--border); }
.tabs a { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 14px; color: var(--text); text-decoration: none;
  font-size: 14px; font-weight: 500; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs a:hover { background: var(--surface-2); }
.tabs a[aria-current=page] { color: var(--nav-active-text); border-bottom-color: var(--nav-indicator); font-weight: 700; }
.subtabs ul { margin-top: calc(-1 * var(--space-3)); }
.client-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-4); }
.client-head h1 { margin-bottom: var(--space-2); }
.period-form { margin-bottom: var(--space-4); }
.section-title { font-size: 19px; margin: var(--space-2) 0 var(--space-3); }
.optional { font-weight: 400; color: var(--text-muted); }
.filters-bar { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: flex-end; }
.filters-bar .field { margin: 0; flex: 1 1 200px; }
.form-wide fieldset { border-top: 1px solid var(--border); padding-top: var(--space-4); margin-bottom: var(--space-4); }
.form-wide fieldset:first-of-type { border-top: 0; padding-top: 0; }
.checks .full { grid-column: 1 / -1; }
textarea.plain { font-family: var(--font); font-size: 15px; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); }
.stats.compact .stat:not(.card) { padding: 0; }
.row-menu { position: relative; }
.row-menu > summary { list-style: none; color: var(--secondary-text); }
.row-menu > summary::-webkit-details-marker { display: none; }
.row-menu[open] > summary { border-color: var(--border-strong); }
.row-menu-body { margin-top: var(--space-2); padding: var(--space-4); border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow); min-width: min(320px, 80vw); }
.row-menu-body form { margin-bottom: var(--space-3); }
.team-list > li { align-items: flex-start; }
.team-list .row-actions { flex-wrap: wrap; justify-content: flex-end; }
.danger-zone { border-color: var(--danger-text); }
.danger-zone h3 { margin-top: 0; }
.field-status { font-size: 13px; margin: 4px 0 0; min-height: 0; }
.field-status:empty { display: none; }
.field-status.ok { color: var(--ok-text); }
.field-status.warn { color: var(--warn-text); }
.field-status.error { color: var(--danger-text); font-weight: 600; }
.lookup .field-status { position: static; }
/* Combobox de CNAE */
.combo { position: relative; }
.combo-chips { margin: 0 0 var(--space-2); }
.combo-chips li { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 12px; max-width: 100%; }
.combo-chips span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-remove { min-height: 32px; width: 32px; padding: 0; border-radius: 999px; background: transparent; color: var(--secondary-text);
  font-size: 18px; line-height: 1; flex: none; }
.chip-remove:hover { background: var(--surface); }
.combo-list { position: absolute; z-index: 15; left: 0; right: 0; top: 100%; margin: 4px 0 0; padding: 4px; list-style: none;
  max-height: 300px; overflow-y: auto; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius);
  box-shadow: var(--drawer-shadow); }
.combo-list [role=option] { padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer; font-size: 14px; min-height: 36px; }
.combo-list [role=option]:hover { background: var(--surface-2); }
.combo-list [role=option][aria-selected=true] { background: var(--nav-active-bg); color: var(--nav-active-text); outline: 2px solid var(--focus); outline-offset: -2px; }
.combo-list mark { background: var(--warn-bg); color: inherit; border-radius: 2px; padding: 0 1px; }
.combo-empty { padding: 8px 10px; color: var(--text-muted); font-size: 14px; }
/* Gráficos (SVG do servidor) */
.chart { margin: 0; }
.chart-title { font-weight: 700; font-size: 16px; margin-bottom: 4px; }
.chart-note { font-size: 13px; color: var(--text-muted); margin-bottom: var(--space-2); }
.chart-svg { display: block; width: 100%; height: 150px; }
.chart-bar { fill: var(--chart-1); }
.chart-hit { fill: transparent; }
.chart-col:hover .chart-hit { fill: var(--surface-2); }
.chart-base { stroke: var(--border-strong); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart-axis { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.chart-table { margin-top: var(--space-2); }
.chart-table summary { font-size: 13px; }
.bar-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.bar-table th, .bar-table td { padding: 6px 0; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--border); }
.bar-table tbody tr:last-child th, .bar-table tbody tr:last-child td { border-bottom: 0; }
.bar-table th[scope=row] { font-weight: 500; padding-right: var(--space-3); width: 34%; overflow-wrap: anywhere; }
.bar-cell { display: flex; align-items: center; gap: var(--space-3); }
.bar-svg { flex: 1; height: 14px; min-width: 60px; }
.bar-track { fill: var(--chart-track); }
.bar-value { font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 11ch; text-align: right; }
.bar-table .bar-extra { color: var(--text-muted); font-size: 13px; white-space: nowrap; padding-left: var(--space-5); text-align: right; }
@media (max-width: 720px) {
  .tabs ul { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; }
  .tabs a { white-space: nowrap; }
  .bar-table th[scope=row] { width: auto; display: block; border: 0; padding-bottom: 0; }
  .bar-table tr { display: block; border-bottom: 1px solid var(--border); padding: 4px 0; }
  .bar-table td { display: block; border: 0; padding: 2px 0; }
  .bar-table .bar-extra { padding-left: 0; }
  .client-head .head-actions { width: 100%; }
}
@media (forced-colors: active) {
  .chart-bar { fill: CanvasText; }
  .tabs a[aria-current=page] { border-bottom-color: Highlight; }
}
/* Administração no menu lateral: grupos com submenu (acordeão). */
.nav-group-toggle { width: 100%; background: transparent; border: 0; justify-content: flex-start; text-align: left; cursor: pointer;
  font: inherit; font-size: 14px; font-weight: 500; color: var(--text); }
.nav-group-toggle:hover { background: var(--surface-2); filter: none; }
.nav-group-toggle > span { flex: 1; }
.nav-group-toggle .icon:last-child { width: 16px; height: 16px; color: var(--text-muted); transition: transform var(--dur-fast) var(--ease); }
.nav-group-toggle[aria-expanded=true] .icon:last-child { transform: rotate(90deg); }
.nav-group.has-current > .nav-group-toggle { font-weight: 700; color: var(--nav-active-text); }
.nav-group.has-current > .nav-group-toggle .icon:first-child { color: var(--nav-active-icon); }
.side-nav .nav-sub[hidden] { display: none; }
.side-nav .nav-sub { margin: 2px 0 6px 21px; padding-left: 12px; border-left: 1px solid var(--border); gap: 2px; }
.nav-subitem { display: flex; align-items: center; min-height: 44px; padding: 8px 12px; border-radius: var(--radius); color: var(--text);
  text-decoration: none; font-size: 14px; position: relative; }
.nav-subitem:hover { background: var(--surface-2); text-decoration: none; }
.nav-subitem[aria-current=page] { background: var(--nav-active-bg); color: var(--nav-active-text); font-weight: 700; }
.nav-subitem[aria-current=page]::before { content: ""; position: absolute; left: -14px; top: 10px; bottom: 10px; width: 3px;
  border-radius: 3px; background: var(--nav-indicator); }
@media (forced-colors: active) { .nav-subitem[aria-current=page]::before { background: Highlight; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important;
    scroll-behavior: auto !important; }
}
@media (forced-colors: active) {
  .badge, .meter, .notice, .form-error { border: 1px solid CanvasText; }
  .meter span { background: Highlight; }
}
@media print {
  .sidebar, .topbar, .visitor-header, .nav-backdrop, .site-footer, .skip-link, .head-actions, .pagination, .refine, button { display: none !important; }
  .shell { display: block; }
  .card { box-shadow: none; border-color: #ccc; }
}

.data-table.stack td[data-label]::before { font-family: var(--font); }
#base-status form { margin-bottom: var(--space-4); }

/* Documentação pública da API */
.visitor-nav { margin-left: auto; }
.visitor-nav ul { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.visitor-nav a:not(.button) { color: var(--text); text-decoration: none; padding: 10px 12px; border-radius: var(--radius-sm); font-size: 14px;
  font-weight: 500; display: inline-block; min-height: 44px; }
.visitor-nav a:not(.button):hover, .visitor-nav a[aria-current=page] { background: var(--nav-active-bg); color: var(--nav-active-text); }
.docs-layout { display: grid; grid-template-columns: minmax(220px, 270px) minmax(0, 1fr); gap: var(--space-6); align-items: start; }
.docs-sidebar { position: sticky; top: var(--space-4); max-height: calc(100vh - 32px); overflow-y: auto; padding: var(--space-4);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); font-size: 14px; }
.docs-sidebar .eyebrow { margin-top: 0; }
.docs-search { margin-bottom: var(--space-4); }
.docs-search label { display: block; font-weight: 600; font-size: 13px; margin-bottom: var(--space-1); }
.docs-search input { width: 100%; }
.docs-nav ul { list-style: none; margin: 0; padding: 0; }
.docs-nav > ul > li { margin-bottom: var(--space-3); }
.docs-nav > ul > li > a { font-weight: 650; }
.docs-nav ul ul { margin: var(--space-1) 0 0; padding-left: var(--space-3); border-left: 2px solid var(--border); }
.docs-nav a { display: block; padding: 5px 8px; border-radius: var(--radius-sm); color: var(--text); text-decoration: none; min-height: 24px; }
.docs-nav a:hover { background: var(--surface-2); text-decoration: underline; }
.docs-nav a[aria-current=page] { color: var(--link); background: var(--info-bg); }
.docs-side-title { font-size: 13px; margin: var(--space-4) 0 var(--space-2); }
.docs-downloads { margin: 0; padding-left: 18px; }
.docs-downloads li { margin-bottom: var(--space-1); }
.docs-content { min-width: 0; }
.docs-content .card { scroll-margin-top: var(--space-4); }
.docs-anchor { scroll-margin-top: var(--space-4); }
.anchor-link { margin-left: 6px; font-size: .8em; color: var(--text-muted); text-decoration: none; opacity: .6; }
.anchor-link:hover, .anchor-link:focus-visible { opacity: 1; color: var(--link); }
.code-tabs { margin: var(--space-4) 0; }
.code-panel { margin-bottom: var(--space-3); }
.code-head { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); margin-bottom: var(--space-1); }
.code-lang { font-weight: 650; font-size: 13px; color: var(--text-muted); }
.code-tabs pre, .code-panel pre { max-height: 520px; overflow: auto; }
.code-tablist { display: flex; flex-wrap: wrap; gap: var(--space-1); margin-bottom: var(--space-2); border-bottom: 1px solid var(--border); }
.code-tablist button { background: transparent; color: var(--text); border: 0; border-bottom: 3px solid transparent; border-radius: 0;
  padding: 8px 14px; min-height: 44px; font-weight: 600; cursor: pointer; }
.code-tablist button[aria-selected=true] { color: var(--link); border-bottom-color: var(--primary); }
.code-tablist button:hover { background: var(--surface-2); filter: none; }
.js .code-tabs[data-ready] .code-head .code-lang { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
.js .code-tabs[data-ready] .code-head { justify-content: flex-end; }
.endpoint-route { font-size: 15px; display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.endpoint-route code { overflow-wrap: anywhere; }
.method { display: inline-block; font-family: var(--mono); font-weight: 700; font-size: 12px; padding: 3px 8px; border-radius: var(--radius-sm); }
.method-get { background: var(--ok-bg); color: var(--ok-text); }
.method-post { background: var(--info-bg); color: var(--info-text); }
.error-entry { padding: var(--space-3) 0; border-bottom: 1px solid var(--border); scroll-margin-top: var(--space-4); }
.error-entry:last-child { border-bottom: 0; }
.error-entry h3 { margin: 0 0 var(--space-2); }
.data-table.compact { max-width: 520px; }
.docs-content h3 small { font-weight: 400; }
@media (max-width: 1080px) {
  .docs-layout { grid-template-columns: 1fr; gap: var(--space-4); }
  .docs-sidebar { position: static; max-height: none; }
}
@media (max-width: 720px) {
  .visitor-nav { margin-left: 0; width: 100%; }
}
@media (forced-colors: active) {
  .code-tablist button[aria-selected=true] { border-bottom-color: Highlight; }
}
@media print {
  .docs-sidebar, .code-tablist { display: none; }
  .docs-layout { display: block; }
}
.docs-index > summary { cursor: pointer; font-weight: 650; padding: 8px 0; min-height: 44px; display: flex; align-items: center; }
@media (min-width: 1081px) { .docs-index > summary { display: none; } }
