/* =====================================================================
   pront.ai — Base e componentes
   Depende de tokens.css. Nenhuma cor "solta" aqui: sempre var(--...).
   ===================================================================== */

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-heading); color: var(--color-heading); line-height: var(--leading-tight); margin: 0 0 var(--space-2); }
h1 { font-size: var(--text-2xl); font-weight: var(--weight-black); }
h2 { font-size: var(--text-xl);  font-weight: var(--weight-black); }
h3 { font-size: var(--text-lg);  font-weight: var(--weight-bold); }
h4 { font-size: var(--text-md);  font-weight: var(--weight-bold); }
p { margin: 0 0 var(--space-3); }
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code, kbd { font-family: var(--font-mono); font-size: 0.92em; }
img, svg { display: block; max-width: 100%; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-sm); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--color-text-muted); }
.eyebrow { font-size: var(--text-xs); font-weight: var(--weight-bold); letter-spacing: .08em; text-transform: uppercase; color: var(--color-primary); }

/* ---------- Marca ---------- */
.brand { display: inline-flex; align-items: center; gap: var(--space-2); font-family: var(--font-heading); font-weight: var(--weight-black); font-size: var(--text-lg); color: var(--color-heading); letter-spacing: -0.01em; }
.brand img { width: 28px; height: 28px; }
/* Uso: <span class="brand"><img src="logo-icon.svg" alt=""><span>pront<span class="brand-ai">.ai</span></span></span>
   (o nome fica num span próprio para o "gap" não separar "pront" de ".ai") */
.brand .brand-ai { color: var(--brand-teal); }
.brand--inverse { color: var(--color-text-inverse); }
.brand--inverse .brand-ai { color: var(--brand-teal-300); }

/* ---------- Logo da CLÍNICA (co-branding, docs/identidade/marca.md) ----------
   O topo do menu lateral mostra SEMPRE a marca da clínica; o pront.ai fica
   no rodapé (.powered-by). Favicon/PWA nunca usam o logo da clínica. */
.org-brand { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-1) var(--space-2) var(--space-3); border-bottom: 1px solid rgba(255,255,255,.08); min-height: 56px; }
.org-brand img { max-height: 44px; max-width: 200px; width: auto; object-fit: contain; }
.org-brand img.org-logo--light-on-dark { background: #fff; padding: 4px 8px; border-radius: var(--radius-md); }  /* sem versão escura */
.org-brand-name { font-family: var(--font-heading); font-weight: var(--weight-black); font-size: var(--text-lg); color: #fff; line-height: 1.15; }
.org-brand-sub { display: block; font-family: var(--font-body); font-size: var(--text-2xs); font-weight: var(--weight-medium); color: #b8c7d6; }
.powered-by { margin-top: auto; display: inline-flex; align-items: center; gap: 6px; padding: var(--space-3) var(--space-2) 0; font-size: var(--text-2xs); color: #8fa3b8; opacity: .85; text-decoration: none; }
.powered-by img { width: 14px; height: 14px; }
.powered-by b { color: #dbe5ef; font-weight: var(--weight-bold); }
.doc-header { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); padding-bottom: var(--space-3); border-bottom: 2px solid var(--brand-navy); }
.doc-header img { max-height: 56px; max-width: 240px; object-fit: contain; }

/* ---------- Layout do app (Zonas A · B · C, Doc 2 §3.2) ---------- */
.app-shell {
  display: grid;
  grid-template-columns: var(--layout-sidebar-w) minmax(0, 1fr) var(--layout-marks-w);
  min-height: 100vh;
}
.app-shell--no-marks { grid-template-columns: var(--layout-sidebar-w) minmax(0, 1fr); }
.app-main { display: flex; flex-direction: column; min-width: 0; }
.app-content { padding: var(--space-6); flex: 1; }
.panel-current { flex: 0 0 var(--layout-current-h); overflow: auto; }
.panel-history { flex: 0 0 var(--layout-history-h); overflow: auto; }

/* Zona A — menu lateral escuro */
.sidebar { background: var(--brand-navy); color: #dbe5ef; display: flex; flex-direction: column; padding: var(--space-4) var(--space-3); gap: var(--space-4); position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar .brand { padding: 0 var(--space-2); }
.sidebar-section-title { font-size: var(--text-xs); font-weight: var(--weight-bold); color: #fff; padding: 0 var(--space-2); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: var(--space-3); padding: 9px var(--space-3); border-radius: var(--radius-md); color: #dbe5ef; font-weight: var(--weight-medium); text-decoration: none; transition: background var(--dur-fast) var(--ease); }
.nav-item svg { width: 18px; height: 18px; opacity: .85; }
.nav-item:hover { background: rgba(255,255,255,.07); text-decoration: none; }
.nav-item[aria-current="page"] { background: var(--brand-teal); color: #fff; }

/* Fila de espera no menu lateral (Doc 2 §3.2) */
.queue-count { font-family: var(--font-heading); font-size: var(--text-3xl); font-weight: var(--weight-black); color: var(--brand-teal-300); line-height: 1; }
.queue-item { display: flex; align-items: center; gap: var(--space-2); padding: 6px var(--space-2); font-size: var(--text-sm); }
.queue-item .avatar { width: 24px; height: 24px; font-size: 10px; }
.queue-item .wait { margin-left: auto; font-size: var(--text-xs); color: #b8c7d6; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--clin-better); flex: none; }
.status-dot--warn { background: #f59e0b; }
.status-dot--late { background: var(--clin-worse); }

/* Zona C — marcações */
.marks { background: var(--color-surface); border-left: 1px solid var(--color-border); padding: var(--space-4); overflow-y: auto; height: 100vh; position: sticky; top: 0; }

/* Cabeçalho da página */
.page-header { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); padding: var(--space-4) var(--space-6); background: var(--color-surface); border-bottom: 1px solid var(--color-border); min-height: var(--layout-header-h); }

/* Selo de ambiente (HML) */
.env-badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: var(--radius-pill); background: var(--env-hml-bg); color: var(--env-hml); font-size: var(--text-xs); font-weight: var(--weight-bold); text-transform: uppercase; letter-spacing: .04em; }

/* ---------- Superfícies ---------- */
.card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: var(--space-5); box-shadow: var(--shadow-sm); }
.card-title { display: flex; align-items: center; gap: var(--space-2); font-family: var(--font-heading); font-weight: var(--weight-bold); font-size: var(--text-lg); color: var(--color-heading); margin-bottom: var(--space-3); }
.divider { height: 1px; background: var(--color-border); border: 0; margin: var(--space-4) 0; }

/* ---------- Botões ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); min-height: 38px; padding: 8px 16px; border-radius: var(--radius-md); border: 1px solid transparent; font: inherit; font-weight: var(--weight-semibold); cursor: pointer; text-decoration: none; transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease); }
.btn svg { width: 16px; height: 16px; }
.btn:hover { text-decoration: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn--primary   { background: var(--color-primary); color: #fff; }
.btn--primary:hover { background: var(--color-primary-hover); }
.btn--secondary { background: var(--color-surface); color: var(--color-heading); border-color: var(--color-border-strong); }
.btn--secondary:hover { background: var(--color-surface-alt); }
.btn--ghost     { background: transparent; color: var(--color-heading); }
.btn--ghost:hover { background: var(--color-surface-alt); }
.btn--danger    { background: var(--color-danger); color: #fff; }
.btn--sm { min-height: 30px; padding: 4px 10px; font-size: var(--text-sm); }
.btn--icon { width: 38px; padding: 0; }

/* ---------- Formulários ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--space-4); }
.field-label { font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--gray-700); display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.field-hint { font-size: var(--text-xs); color: var(--color-text-muted); }
.input, .textarea, .select {
  width: 100%; font: inherit; color: var(--color-text); background: var(--color-surface);
  border: 1px solid var(--color-border-strong); border-radius: var(--radius-md); padding: 9px 12px;
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.textarea { min-height: 110px; resize: vertical; line-height: var(--leading-normal); }
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--color-focus); box-shadow: var(--ring); }
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--color-danger); }
.field-error { font-size: var(--text-xs); color: var(--color-danger); }
.checkbox { display: inline-flex; align-items: center; gap: var(--space-2); cursor: pointer; }
.checkbox input { width: 16px; height: 16px; accent-color: var(--color-primary); }

/* Campo com ditado por voz (docs/arquitetura/ditado-por-voz.md) */
.voice-wrap { position: relative; }
.voice-wrap .textarea, .voice-wrap .input { padding-right: 46px; }
.voice-btn {
  position: absolute; top: 6px; right: 6px; width: 32px; height: 32px; border-radius: var(--radius-pill);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  background: var(--color-surface-alt); color: var(--color-heading); border: 1px solid var(--color-border);
  transition: background var(--dur-fast) var(--ease);
}
.voice-btn svg { width: 16px; height: 16px; pointer-events: none; }
.voice-btn:hover { background: var(--brand-navy-100); }
.voice-btn[aria-pressed="true"] { background: var(--color-danger); color: #fff; border-color: transparent; animation: voice-pulse 1.4s ease-in-out infinite; }
.voice-btn[data-engine="local"]::after,
.voice-btn[data-engine="cloud"]::after { position: absolute; bottom: -3px; right: -3px; font-size: 9px; line-height: 1; padding: 2px; border-radius: 50%; background: var(--color-surface); }
.voice-btn[data-engine="local"]::after { content: "🔒"; }
.voice-btn[data-engine="cloud"]::after { content: "☁️"; }
.voice-status { font-size: var(--text-xs); color: var(--color-text-muted); min-height: 1em; }
@keyframes voice-pulse { 0%,100% { box-shadow: 0 0 0 3px rgba(185,28,28,.18); } 50% { box-shadow: 0 0 0 7px rgba(185,28,28,.06); } }
.btn--ai { background: var(--ai-bg); color: var(--ai); border-color: var(--ai-border); }
.btn--ai:hover { background: #ede9fe; }

/* Estado de salvamento (autosave, Doc 2 §3.6) */
.save-status { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-xs); color: var(--color-text-muted); }
.save-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--clin-better); }
.save-status[data-state="saving"]::before { background: #f59e0b; }
.save-status[data-state="error"]::before  { background: var(--color-danger); }

/* ---------- Pílulas, etiquetas, avatares ---------- */
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: var(--radius-pill); border: 1px solid; font-size: var(--text-2xs); font-weight: var(--weight-bold); text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
.pill--success { background: var(--color-success-bg); color: var(--color-success); border-color: var(--color-success-border); }
.pill--warning { background: var(--color-warning-bg); color: var(--color-warning); border-color: var(--color-warning-border); }
.pill--danger  { background: var(--color-danger-bg);  color: var(--color-danger);  border-color: var(--color-danger-border); }
.pill--info    { background: var(--color-info-bg);    color: var(--color-info);    border-color: var(--color-info-border); }
.pill--neutral { background: var(--gray-100); color: var(--gray-600); border-color: var(--gray-300); }
.tag-ai { display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; border-radius: var(--radius-sm); background: var(--ai-bg); color: var(--ai); border: 1px dashed var(--ai-border); font-size: var(--text-2xs); font-weight: var(--weight-bold); }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--brand-teal); color: #fff; font-weight: var(--weight-bold); font-size: var(--text-xs); flex: none; }
.cid { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border: 1px solid var(--brand-teal); color: var(--color-heading); background: var(--brand-teal-50); border-radius: var(--radius-sm); font-size: var(--text-2xs); font-weight: var(--weight-semibold); }
.cid--primary { background: var(--brand-teal); color: #fff; }

/* ---------- Indicadores clínicos (faixa divisória, Doc 2 §3.3 / §6.5) ---------- */
.indicator-strip { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-4); background: var(--color-surface); border-top: 1px solid var(--color-border); border-bottom: 1px solid var(--color-border); overflow-x: auto; }
.indicator { display: flex; flex-direction: column; gap: 2px; min-width: 76px; padding: 4px 8px; border-radius: var(--radius-md); }
.indicator-name { font-size: var(--text-2xs); color: var(--color-text-muted); font-weight: var(--weight-semibold); }
.indicator-value { display: flex; align-items: center; gap: 6px; font-family: var(--font-heading); font-weight: var(--weight-black); color: var(--color-heading); }
.indicator-trend { width: 18px; height: 18px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 10px; }
.indicator[data-trend="better"] .indicator-trend { background: var(--clin-better); }
.indicator[data-trend="worse"]  .indicator-trend { background: var(--clin-worse); }
.indicator[data-trend="stable"] .indicator-trend { background: var(--clin-stable); }

/* ---------- Marcações da sessão (Doc 2 §8.3) ---------- */
.mark-legend { display: flex; gap: var(--space-4); font-size: var(--text-xs); margin-bottom: var(--space-3); }
.mark-legend span { display: inline-flex; align-items: center; gap: 6px; }
.mark-legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.mark-group-title { font-size: var(--text-xs); font-weight: var(--weight-bold); color: var(--gray-600); margin: var(--space-3) 0 var(--space-1); }
.mark { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); padding: 3px 6px; border-radius: var(--radius-sm); font-size: var(--text-sm); }
.mark-box { position: relative; width: 18px; height: 18px; border-radius: 4px; border: 1.5px solid var(--gray-300); background: var(--color-surface); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.mark[data-previous="true"] { color: var(--mark-previous); font-weight: var(--weight-semibold); }
.mark[data-previous="true"] .mark-box { border-color: var(--mark-previous); background: var(--mark-previous-bg); cursor: not-allowed; }
.mark[data-previous="true"] .mark-box::before { content: "🔒"; font-size: 9px; }
.mark[data-current="true"] .mark-box { border-color: var(--mark-current); background: var(--mark-current); }
.mark[data-current="true"] .mark-box::after { content: "✓"; color: #fff; font-size: 12px; font-weight: 800; }
.mark[data-previous="true"][data-current="true"] .mark-box { background: var(--mark-current); box-shadow: 0 0 0 2px var(--mark-previous); }
.mark[data-previous="true"][data-current="true"] .mark-box::before { content: none; }
.mark[data-suggested="true"] .mark-box { border-style: dashed; border-color: var(--ai); background: var(--ai-bg); }

/* ---------- Tabela ---------- */
.table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.table th { text-align: left; font-weight: var(--weight-bold); color: var(--gray-700); background: var(--gray-100); padding: 8px 12px; border-bottom: 1px solid var(--color-border-strong); }
.table td { padding: 8px 12px; border-bottom: 1px solid var(--color-border); vertical-align: top; }
.table tr:hover td { background: var(--gray-50); }

/* Histórico (Doc 2 §7.2: data + descrição completa, sem clique) */
.history-item { display: grid; grid-template-columns: 96px 1fr; gap: var(--space-4); padding: var(--space-3) 0; border-bottom: 1px solid var(--color-border); }
.history-date { font-family: var(--font-heading); font-weight: var(--weight-bold); color: var(--color-heading); }
.history-text { color: var(--gray-700); }

/* ---------- Avisos ---------- */
.alert { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); border: 1px solid; font-size: var(--text-sm); }
.alert--info    { background: var(--color-info-bg);    border-color: var(--color-info-border);    color: var(--color-info); }
.alert--success { background: var(--color-success-bg); border-color: var(--color-success-border); color: var(--color-success); }
.alert--warning { background: var(--color-warning-bg); border-color: var(--color-warning-border); color: var(--color-warning); }
.alert--danger  { background: var(--color-danger-bg);  border-color: var(--color-danger-border);  color: var(--color-danger); }

/* ---------- Estados de tela (Doc 2 §3.5) ---------- */
.skeleton { background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 37%, var(--gray-100) 63%); background-size: 400% 100%; animation: skeleton 1.4s ease infinite; border-radius: var(--radius-sm); min-height: 12px; }
@keyframes skeleton { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.empty-state { text-align: center; padding: var(--space-10) var(--space-6); color: var(--color-text-muted); }
.readonly-banner { background: var(--gray-100); border: 1px dashed var(--gray-400); color: var(--gray-600); padding: var(--space-2) var(--space-4); border-radius: var(--radius-md); font-size: var(--text-sm); }

/* ---------- Utilidades de página ---------- */
.row-flex { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-5); }
.big-number { font-family: var(--font-heading); font-size: var(--text-3xl); font-weight: var(--weight-black); color: var(--brand-teal); line-height: 1; }
.progress { height: 8px; background: var(--gray-200); border-radius: var(--radius-pill); overflow: hidden; margin: 4px 0; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--brand-teal), var(--brand-teal-400)); border-radius: var(--radius-pill); }
.menu-toggle { display: none; }
.app-content > .alert { margin-bottom: var(--space-4); }
.phase-items summary { cursor: pointer; font-size: var(--text-xs); color: var(--color-text-muted); }
.phase-items ul { list-style: none; padding: 0; margin: 6px 0 0; display: grid; gap: 4px; font-size: var(--text-xs); }

/* ---------- Menu lateral no padrão do modelo proposto (docs/especificacao/modeloproposto.png) ----------
   Parecido, não idêntico: fundo navy, ícones de linha, item ativo em faixa teal de ponta a ponta,
   bloco de resumo no topo (no modelo: "Fila de Espera"), seções com título e divisórias. */
.sidebar { padding: 0 0 var(--space-4); gap: 0; }
.sidebar .org-brand { padding: var(--space-4) var(--space-4) var(--space-4) var(--space-5); margin: 0; }
.brand-block { display: flex; flex-direction: column; gap: 4px; }
.org-switch .select { margin-top: 6px; padding: 4px 8px; font-size: var(--text-xs); background: rgba(255,255,255,.08); color: #fff; border-color: rgba(255,255,255,.2); }
.org-switch .select option { color: var(--color-text); }
.side-summary { display: block; padding: var(--space-4) var(--space-5); border-bottom: 1px solid rgba(255,255,255,.08); color: #dbe5ef; text-decoration: none; }
.side-summary:hover { background: rgba(255,255,255,.04); text-decoration: none; }
.side-summary-title { display: block; font-family: var(--font-heading); font-weight: var(--weight-bold); color: #fff; font-size: var(--text-md); margin-bottom: 2px; }
.side-summary-row { display: flex; align-items: baseline; gap: var(--space-2); font-size: var(--text-sm); }
/* Fila de espera (v0.12.2): pacientes com status "Chegou" hoje; ponto verde < 15 min, amarelo < 30, vermelho ≥ 30 */
.side-queue { list-style: none; margin: var(--space-3) 0 0; padding: 0; display: grid; gap: var(--space-2); }
.side-queue li { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); color: #dbe5ef; min-width: 0; }
.side-queue-ava { width: 28px; height: 28px; border-radius: 50%; background: rgba(255,255,255,.12); color: #fff; display: inline-grid; place-items: center; font-size: 11px; font-weight: var(--weight-bold); flex: none; overflow: hidden; }
.side-queue-ava img { width: 100%; height: 100%; object-fit: cover; }
.side-queue-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; }
.side-queue-name::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--wait, #34d399); flex: none; }
.side-queue-wait { display: inline-flex; align-items: center; gap: 5px; font-size: var(--text-xs); color: #b6c4d3; white-space: nowrap; }
.side-queue-wait::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--wait, #34d399); }
.side-queue .is-mid { --wait: #fbbf24; } .side-queue .is-late { --wait: #f87171; }
.side-queue-more summary { list-style: none; cursor: pointer; font-size: var(--text-xs); color: #b6c4d3; margin-top: var(--space-2); }
.side-queue-more summary::-webkit-details-marker { display: none; }
.side-summary-n { font-family: var(--font-heading); font-size: var(--text-3xl); font-weight: var(--weight-black); color: var(--brand-teal-300); line-height: 1; }
.sidebar .nav { gap: 0; padding: var(--space-2) 0; }
.sidebar .nav-item { border-radius: 0; padding: 11px var(--space-5); font-size: 15px; gap: 14px; color: #e6edf4; }
.sidebar .nav-item .ico { width: 20px; height: 20px; opacity: .9; flex: none; }
.sidebar .nav-item > span:not(.nav-badge) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.sidebar .nav-item:hover { background: rgba(255,255,255,.06); }
.sidebar .nav-item[aria-current="page"] { background: var(--brand-teal); color: #fff; box-shadow: inset 3px 0 0 var(--brand-teal-300); }
.nav-section { border-top: 1px solid rgba(255,255,255,.08); padding-top: var(--space-3); }
.nav-section-title { display: block; padding: 0 var(--space-5); font-family: var(--font-heading); font-weight: var(--weight-bold); color: #fff; font-size: var(--text-md); }
/* seletor de idioma (v0.7.0) */
.lang-switch .select { padding: 4px 8px; font-size: var(--text-xs); min-width: 0; width: auto; }
/* botão de tema (v0.5.4): mostra a lua no claro e o sol no escuro */
.theme-toggle .theme-to-light { display: none; }
:root[data-theme="dark"] .theme-toggle .theme-to-light { display: inline-flex; }
:root[data-theme="dark"] .theme-toggle .theme-to-dark { display: none; }
:root[data-theme="dark"] .aviso-personificacao { background: rgba(245,158,11,.15); color: #fde68a; }
/* logo da clínica no menu (v0.5.3) */
.org-logo { display: block; max-height: 44px; max-width: 190px; object-fit: contain; }
.org-logo--plate { background: #fff; padding: 4px 8px; border-radius: var(--radius-md); }
.logo-preview { display: flex; align-items: center; justify-content: center; height: 90px; border: 1px solid var(--color-border); border-radius: var(--radius-md); margin-bottom: var(--space-2); }
.logo-preview img { max-height: 70px; max-width: 90%; object-fit: contain; }
.logo-preview--dark { background: #13304d; }
.logo-preview--light { background: #fff; }
/* seções recolhíveis: nascem abertas (<details open>), clique no título recolhe */
summary.nav-section-title { display: flex; align-items: center; justify-content: space-between; cursor: pointer; list-style: none; user-select: none; }
summary.nav-section-title::-webkit-details-marker { display: none; }
summary.nav-section-title::after { content: "▾"; font-size: .8em; opacity: .7; transition: transform .15s; }
details.nav-section:not([open]) > summary.nav-section-title::after { transform: rotate(-90deg); }
.sidebar .powered-by { padding: var(--space-4) var(--space-5) 0; }
.btn .ico, .bell .ico { width: 20px; height: 20px; }
.btn--sm .ico { width: 16px; height: 16px; }
.sidebar-collapse { display: inline-flex; align-items: center; justify-content: center; }

/* Menu lateral recolhível (desktop) */
.sidebar-head { justify-content: space-between; }
.sidebar-collapse { background: transparent; border: 1px solid rgba(255,255,255,.18); color: #dbe5ef; width: 28px; height: 28px; border-radius: var(--radius-md); cursor: pointer; font-size: 16px; line-height: 1; }
.sidebar-collapse:hover { background: rgba(255,255,255,.08); }
.app-shell { transition: grid-template-columns var(--dur) var(--ease); }
@media (min-width: 1025px) {
  :root[data-sidebar="collapsed"] .app-shell { grid-template-columns: 0 minmax(0, 1fr); }
  :root[data-sidebar="collapsed"] .app-shell:not(.app-shell--no-marks) { grid-template-columns: 0 minmax(0, 1fr) var(--layout-marks-w); }
  :root[data-sidebar="collapsed"] .sidebar { visibility: hidden; padding: 0; overflow: hidden; }
}
.nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--radius-pill); background: var(--color-danger); color: #fff; font-size: var(--text-2xs); font-weight: var(--weight-bold); display: inline-flex; align-items: center; justify-content: center; }

/* Sininho da Central de mensagens */
.bell { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: var(--radius-md); color: var(--color-heading); }
.bell:hover { background: var(--color-surface-alt); text-decoration: none; }
.bell-count { position: absolute; top: 2px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--radius-pill); background: var(--color-danger); color: #fff; font-size: 10px; font-weight: var(--weight-bold); display: inline-flex; align-items: center; justify-content: center; border: 2px solid var(--color-surface); }

/* Central de mensagens */
.msg-list { list-style: none; padding: 0; margin: var(--space-3) 0 0; display: grid; gap: var(--space-2); }
.msg-btn { width: 100%; display: flex; align-items: center; gap: var(--space-3); text-align: left; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: var(--space-3) var(--space-4); cursor: pointer; font: inherit; color: inherit; transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease); }
.msg-btn:hover { border-color: var(--brand-teal); background: var(--brand-teal-50); }
.msg--unread .msg-btn { border-left: 4px solid var(--brand-teal); }
.msg-icon { font-size: 20px; position: relative; display: inline-flex; flex: none; }
.msg-icon--unread { color: var(--color-primary); }
.msg-icon--read { color: var(--color-text-muted); opacity: .7; }
.msg-dot { position: absolute; top: -2px; right: -3px; width: 9px; height: 9px; border-radius: 50%; background: var(--color-danger); box-shadow: 0 0 0 2px var(--color-surface); }
.msg-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.msg-meta { font-size: var(--text-2xs); color: var(--color-text-muted); }
.msg-go { color: var(--brand-teal); font-weight: var(--weight-bold); white-space: nowrap; }
.msg-list--done li { font-size: var(--text-sm); }
.quick-card { display: block; text-decoration: none; color: inherit; transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease); }
.quick-card:hover { border-color: var(--brand-teal); box-shadow: var(--shadow-md); text-decoration: none; }

/* Admin: cartões de números, vulnerabilidades e logs */
.sec-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-4); margin-top: var(--space-4); }
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat-n { font-family: var(--font-heading); font-size: var(--text-2xl); font-weight: var(--weight-black); color: var(--color-heading); }
.stat-bad { color: var(--color-danger); }
.vuln { padding: 4px 0; border-bottom: 1px dashed var(--color-border); }
.vuln:last-child { border-bottom: 0; }
code.trecho { white-space: pre-wrap; word-break: break-all; font-size: var(--text-xs); }
.logbox { background: var(--gray-900); color: #cbd5e1; padding: var(--space-4); border-radius: var(--radius-md); max-height: 460px; overflow: auto; font-size: var(--text-xs); line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.logbox .log-warning { color: #fcd34d; }
.logbox .log-error { color: #fca5a5; }
.nav-group { font-size: var(--text-2xs); font-weight: var(--weight-bold); text-transform: uppercase; letter-spacing: .08em; color: #8fa3b8; padding: var(--space-3) var(--space-3) 2px; }

.aviso-personificacao { position: sticky; top: 0; z-index: var(--z-sticky); display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); flex-wrap: wrap; background: #fef3c7; border: 1px solid #f59e0b; color: #78350f; border-radius: var(--radius-md); padding: var(--space-2) var(--space-4); margin-bottom: var(--space-4); }

/* Login e telas simples */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: var(--space-6); background: linear-gradient(160deg, var(--brand-navy-100), var(--color-bg)); }
.login-card { width: 100%; max-width: 400px; padding: var(--space-8); box-shadow: var(--shadow-lg); }
.login-card img { display: block; }

/* Aceite */
.accept-item { margin-bottom: var(--space-4); }
.accept-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-3); }
.steps { margin: 0; padding-left: 20px; }
.accept-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-3); margin-top: var(--space-3); }
.accept-cell { background: var(--gray-50); border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: var(--space-3); font-size: var(--text-sm); }
.accept-comment { margin: 6px 0 0; font-style: italic; color: var(--gray-700); }
.accept-form { margin-top: var(--space-4); border: 1px dashed var(--brand-teal); border-radius: var(--radius-md); padding: var(--space-3) var(--space-4); }
.accept-form legend { font-weight: var(--weight-bold); color: var(--brand-teal); padding: 0 6px; }
.radio-group { display: flex; flex-wrap: wrap; gap: var(--space-4); margin-bottom: var(--space-2); }
.sticky-actions { position: sticky; bottom: 0; background: var(--color-bg); padding: var(--space-3) 0; display: flex; gap: var(--space-4); align-items: center; flex-wrap: wrap; }
.close-all { background: var(--brand-teal-50); border: 1px solid var(--brand-teal); border-radius: var(--radius-md); padding: 8px 12px; width: 100%; }

/* Documentação */
.doc-list { display: grid; gap: var(--space-2); padding-left: 18px; }
.md-body { max-width: 980px; line-height: 1.6; }
.md-body h1, .md-body h2, .md-body h3 { margin-top: var(--space-6); }
.md-body table { border-collapse: collapse; width: 100%; margin: var(--space-3) 0; font-size: var(--text-sm); }
.md-body th, .md-body td { border: 1px solid var(--color-border); padding: 6px 10px; text-align: left; vertical-align: top; }
.md-body th { background: var(--gray-100); }
.md-body pre { background: var(--gray-900); color: #e2e8f0; padding: var(--space-4); border-radius: var(--radius-md); overflow-x: auto; }
.md-body code { background: var(--gray-100); padding: 1px 5px; border-radius: 4px; }
.md-body pre code { background: none; padding: 0; }
.md-body blockquote { border-left: 4px solid var(--brand-teal); margin: var(--space-3) 0; padding: 4px var(--space-4); color: var(--gray-600); background: var(--brand-teal-50); }

/* ---------- Responsivo (Doc 2 §3.4) ---------- */
@media (max-width: 1365px) {
  .app-shell { grid-template-columns: var(--layout-sidebar-w) minmax(0, 1fr); }
  .app-shell .marks { display: none; }            /* vira aba: .marks-tab */
}
@media (max-width: 1024px) {
  .app-shell, .app-shell--no-marks { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: var(--layout-sidebar-w); transform: translateX(-100%); transition: transform var(--dur) var(--ease); z-index: var(--z-overlay); }
  .sidebar[data-open="true"] { transform: none; box-shadow: var(--shadow-lg); }
  .app-content { padding: var(--space-4); }
  .menu-toggle { display: inline-flex; }
  .grid-2, .accept-grid { grid-template-columns: minmax(0, 1fr); }
  .sec-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .history-item { grid-template-columns: 1fr; gap: 2px; }
  .page-header { padding: var(--space-3) var(--space-4); }
}

/* ---------- Atalhos de teclado e cadastro rápido de paciente (v0.8.0) ---------- */
.kbd { display: inline-block; padding: 1px 6px; border: 1px solid var(--color-border-strong); border-bottom-width: 2px; border-radius: var(--radius-sm); font-family: var(--font-mono); font-size: var(--text-2xs); line-height: 1.5; color: var(--color-text-muted); background: var(--color-surface-alt); white-space: nowrap; }
.pac-form { max-width: 980px; }
.pac-row { display: grid; gap: var(--space-4); grid-template-columns: repeat(12, minmax(0, 1fr)); }
.pac-row > .field { margin-bottom: var(--space-3); }
.span-2 { grid-column: span 2; } .span-3 { grid-column: span 3; } .span-4 { grid-column: span 4; }
.span-5 { grid-column: span 5; } .span-6 { grid-column: span 6; } .span-8 { grid-column: span 8; } .span-12 { grid-column: span 12; }
@media (max-width: 760px) { .pac-row > .field { grid-column: span 12; } }
.pac-cpf { display: flex; align-items: flex-end; gap: var(--space-4); flex-wrap: wrap; }
.pac-cpf .field { margin-bottom: 0; min-width: 220px; }
.pac-status { font-size: var(--text-sm); min-height: 1.4em; }
.pac-status--ok { color: var(--color-success); } .pac-status--err { color: var(--color-danger); } .pac-status--muted { color: var(--color-text-muted); }
.pac-found { border: 1px solid var(--color-info-border); background: var(--color-info-bg); border-radius: var(--radius-md); padding: var(--space-4); margin: var(--space-4) 0; }
.pac-found-name { font-weight: var(--weight-semibold); font-size: var(--text-md); }
.pac-age { font-size: var(--text-sm); color: var(--color-text-muted); }
.pac-guardian { border-left: 3px solid var(--color-warning); padding-left: var(--space-4); margin: var(--space-2) 0 var(--space-4); }
.pac-more > summary { cursor: pointer; font-weight: var(--weight-semibold); margin: var(--space-2) 0 var(--space-4); }
.pac-actions { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; margin-top: var(--space-4); }
.pac-hidden { display: none !important; }

/* ---------- v0.9.0: foto, cards (carômetro) e tabela de pacientes ---------- */
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.avatar { overflow: hidden; }
.avatar--sm { width: 32px; height: 32px; font-size: var(--text-2xs); }
.avatar--lg { width: 48px; height: 48px; font-size: var(--text-md); }
.avatar--xl { width: 72px; height: 72px; font-size: var(--text-xl); }
.pac-ident { display: flex; gap: var(--space-5); align-items: flex-start; }
.pac-ident-fields { flex: 1; min-width: 0; }
.pac-photo { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); width: 160px; flex: none; }
.pac-photo .avatar--xl { width: 96px; height: 96px; font-size: var(--text-2xl); }
.pac-cam video { width: 160px; border-radius: var(--radius-md); background: #000; }
@media (max-width: 760px) { .pac-ident { flex-direction: column; align-items: center; } .pac-ident-fields { width: 100%; } }
.pac-card-head { display: flex; gap: var(--space-3); align-items: center; }

.icon-actions { display: inline-flex; align-items: center; gap: 2px; }
.icon-actions form { display: inline; margin: 0; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: var(--radius-md); border: 1px solid transparent; background: transparent; color: var(--color-heading); cursor: pointer; text-decoration: none; }
.icon-btn:hover { background: var(--gray-100); border-color: var(--color-border); }
.icon-btn--danger { color: var(--color-danger); }
.icon-btn--danger:hover { background: var(--color-danger-bg); border-color: var(--color-danger-border); }
.icon-btn.is-disabled { color: var(--gray-300); cursor: not-allowed; }
.icon-btn.is-disabled:hover { background: transparent; border-color: transparent; }

.pac-list { margin-top: var(--space-5); }
.pac-list-head, .pac-list-tools, .pac-list-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }
.pac-list-tools { margin: var(--space-4) 0; }
.pac-list-foot { margin-top: var(--space-4); }
.pac-empty { padding: var(--space-5) 0; text-align: center; }
.input-icon { position: relative; display: inline-flex; align-items: center; }
.input-icon .ico { position: absolute; left: 10px; color: var(--color-text-muted); pointer-events: none; }
.input-icon .input { padding-left: 32px; min-width: 260px; }
/* barra de busca da lista: campo cresce, situação e botões no tamanho do conteúdo; no celular, empilha sem estourar */
.pac-list-tools form { flex: 1 1 420px; flex-wrap: wrap; }
.pac-list-tools .input-icon { flex: 1 1 240px; }
.pac-list-tools .input-icon .input { min-width: 0; width: 100%; }
.pac-list-tools .select { width: auto; }
.select--sm { padding: 4px 8px; width: auto; }

.seg { display: inline-flex; gap: 4px; }
.seg-btn { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: var(--radius-pill); border: 1px solid var(--color-border-strong); background: var(--color-surface); color: var(--color-heading); font-size: var(--text-sm); font-weight: var(--weight-semibold); text-decoration: none; }
.seg-btn:hover { border-color: var(--brand-teal); }
.seg-btn.is-active { background: var(--brand-navy); border-color: var(--brand-navy); color: #fff; }
.seg-btn--round { min-width: 30px; justify-content: center; padding: 4px 8px; }
.pager { display: inline-flex; align-items: center; gap: 4px; }

/* Cards responsivos (v0.11.0): 4/6/8 é o MÁXIMO por linha; cada card tem no mínimo --card-min de largura,
   então cabem menos colunas em telas menores e uma só no celular — sem espremer nem quebrar o nome. */
.cards-grid { --cols: 6; --card-min: 220px; display: grid; gap: var(--space-4);
  grid-template-columns: repeat(auto-fill, minmax(max(var(--card-min), calc((100% - (var(--cols) - 1) * var(--space-4)) / var(--cols))), 1fr)); }
.cards-grid--4 { --cols: 4; } .cards-grid--6 { --cols: 6; } .cards-grid--8 { --cols: 8; }
@media (max-width: 480px) { .cards-grid { --card-min: 100%; } }
.pcard { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4); background: var(--color-surface); border: 1px solid var(--color-border); border-left: 4px solid var(--brand-teal); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); min-width: 0; }
.pcard:hover { box-shadow: var(--shadow-md, var(--shadow-sm)); }
.pcard--archived { border-left-color: var(--gray-300); opacity: .8; }

/* ---------- card que vira (v0.16.0 · decisão 49; mesma técnica do StaffProfile: rotateY + backface) ---------- */
.pflip { perspective: 1400px; min-width: 0; }
.pflip-inner { position: relative; display: grid; height: 100%; transition: transform .6s cubic-bezier(.3, .7, .2, 1); transform-style: preserve-3d; }
.pflip.is-flipped .pflip-inner { transform: rotateY(180deg); }
.pflip-face { grid-area: 1 / 1; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.pflip-front { position: relative; }
.pflip-back { transform: rotateY(180deg); gap: var(--space-3);
  border: 3px solid var(--pv-color, var(--brand-teal)); border-radius: 14px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--pv-color, var(--brand-teal)) 10%, transparent) 0%, transparent 40%), var(--color-surface); }
.pflip-btn { position: absolute; top: 8px; right: 8px; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--color-border);
  background: var(--color-surface); color: var(--brand-teal); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; z-index: 1; }
.pflip-btn:hover, .pflip-btn:focus-visible { background: color-mix(in srgb, var(--brand-teal) 12%, var(--color-surface)); }
.pflip [data-flip-area] { cursor: pointer; padding-right: 32px; }
@media (prefers-reduced-motion: reduce) { .pflip-inner { transition: none; } }

.pverso-top { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-2); }
.pverso-top h3 { margin: 0; font-size: var(--text-sm); font-weight: 800; text-transform: uppercase; color: var(--color-heading); line-height: 1.25; }
.pverso-back { flex: none; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--color-border); background: var(--color-surface);
  color: var(--pv-color, var(--brand-teal)); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.pverso-level { display: inline-block; margin-top: 4px; padding: 2px 10px; border-radius: 999px; font-size: var(--text-xs); font-weight: 800;
  letter-spacing: .04em; text-transform: uppercase; color: #fff; background: var(--pv-color, var(--brand-teal)); }
.pverso-block h4 { margin: 0 0 4px; font-size: .7rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--color-text-muted, #64748b); }
.pverso-dl { margin: 0; display: grid; gap: 2px; font-size: var(--text-sm); }
.pverso-dl > div { display: flex; justify-content: space-between; gap: var(--space-2); }
.pverso-dl dt { color: var(--color-text-muted, #64748b); }
.pverso-dl dd { margin: 0; text-align: right; }
.pverso-stats { display: flex; flex-wrap: wrap; gap: var(--space-3); font-size: var(--text-sm); margin-top: 4px; }
.pverso-stats .is-warn b { color: var(--color-danger); }
.pverso-bar { height: 8px; border-radius: 4px; background: var(--color-border); overflow: hidden; }
.pverso-bar span { display: block; height: 100%; background: var(--pv-color, var(--brand-teal)); }
.pverso-hint { margin: 4px 0 0; font-size: var(--text-xs); color: var(--color-text-muted, #64748b); }
.pverso-rank { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; font-size: var(--text-sm); }
.pverso-rank li { display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 6px; }
.pverso-pos { width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-size: var(--text-xs); font-weight: 800; color: #fff; background: var(--pv-color, var(--brand-teal)); }
.pverso-count { font-weight: 700; font-variant-numeric: tabular-nums; }
.pverso-link { font-size: var(--text-sm); font-weight: 600; }
.pverso-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
/* cor da moldura pelo nível (aplicada no verso via :has; sem suporte, fica a cor da marca) */
.pflip-back:has(.pverso-level--bronze) { --pv-color: #b4703c; }
.pflip-back:has(.pverso-level--prata) { --pv-color: #7d8b99; }
.pflip-back:has(.pverso-level--ouro) { --pv-color: #c99a06; }
.pflip-back:has(.pverso-level--diamante) { --pv-color: #2b8bd6; }
.pflip-back:has(.pverso-level--novo) { --pv-color: var(--brand-teal); }
.pcard-head { display: flex; gap: var(--space-3); align-items: center; min-width: 0; }
.pcard-title { display: flex; flex-direction: column; min-width: 0; font-size: var(--text-sm); }
.pcard-name { color: var(--color-heading); text-transform: uppercase; line-height: 1.25; overflow-wrap: break-word; word-break: normal; hyphens: manual; }
/* rótulo pequeno em cima, valor embaixo: nada fica espremido lado a lado */
.pcard-info { margin: 0; display: grid; gap: var(--space-2); font-size: var(--text-sm); }
.pcard-info > div { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.pcard-info dt { color: var(--color-text-muted); font-size: var(--text-2xs); text-transform: uppercase; letter-spacing: .04em; }
.pcard-info dd { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard-foot { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-top: auto; padding-top: var(--space-2); border-top: 1px solid var(--color-border); }
.pcard-foot .icon-actions { margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }
.pcard .avatar--xl { width: 56px; height: 56px; font-size: var(--text-lg); }
.table-wrap { overflow-x: auto; }
.pac-table-name { display: flex; align-items: center; gap: var(--space-2); }

/* ---------- Autocadastro pelo celular (v0.10.0) ---------- */
/* página pública do paciente: uma coluna, pensada para celular */
.auto-wrap { min-height: 100vh; display: flex; justify-content: center; align-items: flex-start; padding: var(--space-4); background: linear-gradient(160deg, var(--brand-navy-100), var(--color-bg)); }
.auto-card { width: 100%; max-width: 560px; padding: var(--space-6); box-shadow: var(--shadow-lg); margin-top: var(--space-4); }
.auto-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-3); margin-bottom: var(--space-4); }
.auto-org { font-family: var(--font-heading); font-size: var(--text-lg); font-weight: var(--weight-bold); color: var(--color-text); }
.auto-title { font-family: var(--font-heading); font-size: var(--text-xl); margin: 0 0 var(--space-2); color: var(--color-text); }
.auto-btn { width: 100%; min-height: 48px; font-size: var(--text-md); margin-top: var(--space-3); }
.auto-foot { text-align: center; margin-top: var(--space-5); display: flex; gap: 6px; justify-content: center; align-items: center; }
.auto-cpf { display: flex; align-items: center; gap: var(--space-2); }
.auto-cpf-input { width: 6ch; font-size: var(--text-2xl); letter-spacing: .3em; text-align: center; font-family: var(--font-mono); }
.auto-cpf-mask { font-family: var(--font-mono); font-size: var(--text-xl); color: var(--color-text-muted); }
.auto-photo { display: flex; gap: var(--space-4); align-items: center; padding: var(--space-4); border: 1px dashed var(--color-border-strong); border-radius: var(--radius-lg); margin: var(--space-4) 0; }
.auto-photo .avatar--xl { width: 96px; height: 96px; font-size: var(--text-2xl); }
.auto-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 var(--space-3); }
.auto-span-2 { grid-column: span 2; }
.auto-consent { align-items: flex-start; gap: var(--space-2); margin-top: var(--space-4); font-size: var(--text-sm); }
.auto-consent input { margin-top: 3px; flex: none; }
.auto-msg { text-align: center; padding: var(--space-6) var(--space-2); }
.auto-msg-icon { width: 56px; height: 56px; margin: 0 auto var(--space-3); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: var(--text-2xl); font-weight: var(--weight-bold); background: var(--color-warning-bg); color: var(--color-warning); }
.auto-msg--ok .auto-msg-icon { background: var(--color-success-bg); color: var(--color-success); }
@media (max-width: 420px) { .auto-grid { grid-template-columns: 1fr; } .auto-span-2 { grid-column: auto; } .auto-card { padding: var(--space-4); } .auto-desktop-only { display: none; } }
/* tela da recepção */
.auto-staff { display: grid; gap: var(--space-4); max-width: 960px; }
.auto-new { border-color: var(--color-info-border); }
.auto-new-body { display: flex; gap: var(--space-5); align-items: center; flex-wrap: wrap; }
.auto-qr { background: #fff; border-radius: var(--radius-md); padding: var(--space-2); line-height: 0; }
.auto-qr svg { width: 168px; height: 168px; }
.auto-new-actions { flex: 1; min-width: 260px; display: grid; gap: var(--space-3); }
.auto-url .input { font-family: var(--font-mono); font-size: var(--text-sm); }
.auto-opt { cursor: pointer; }
.auto-opt input { margin: 0; }
.auto-opt:has(input:checked) { background: var(--brand-navy); border-color: var(--brand-navy); color: #fff; }
.icon-btn--alert { color: var(--color-warning); background: var(--color-warning-bg); border-color: var(--color-warning-border); }
fieldset.seg { border: 0; padding: 0; margin: 0; align-items: center; flex-wrap: wrap; }

/* ---------- Barra de menus do topo, estilo VS Code (v0.11.0) — registro em app/atalhos.py ---------- */
.menubar { display: flex; align-items: center; gap: 2px; padding: 0 var(--space-4); height: 32px; background: var(--color-surface-alt); border-bottom: 1px solid var(--color-border); font-size: var(--text-sm); position: relative; z-index: var(--z-dropdown); }
.menubar-menu { position: relative; }
.menubar-btn { height: 26px; padding: 0 10px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--color-text); font: inherit; cursor: pointer; }
.menubar-btn:hover, .menubar-btn.is-open, .menubar-btn:focus-visible { background: rgba(128, 128, 128, .2); outline: none; }
.menubar-dropdown { position: absolute; top: calc(100% + 3px); left: 0; min-width: 260px; padding: 4px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); }
.menubar-dropdown[hidden] { display: none; }
.menubar-item { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: var(--space-6); padding: 6px 10px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--color-text); font: inherit; text-align: left; text-decoration: none; cursor: pointer; white-space: nowrap; }
.menubar-item:hover, .menubar-item:focus-visible { background: var(--color-primary); color: #fff; outline: none; }
.menubar-item:hover .kbd, .menubar-item:focus-visible .kbd { color: #fff; background: transparent; border-color: rgba(255,255,255,.5); }
.menubar-sep { height: 1px; margin: 4px 6px; background: var(--color-border); }
.atalhos-dialog { border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: var(--space-5); min-width: min(420px, 92vw); background: var(--color-surface); color: var(--color-text); box-shadow: var(--shadow-lg); }
.atalhos-dialog::backdrop { background: rgba(10, 20, 35, .45); }
@media (max-width: 760px) { .menubar { padding: 0 var(--space-2); } .menubar-dropdown { min-width: 220px; } }

/* ---------- Tema escuro: textos claros e fundos escuros onde a cor era fixa (v0.11.0) ---------- */
:root[data-theme="dark"] .field-label,
:root[data-theme="dark"] .history-text,
:root[data-theme="dark"] .accept-comment { color: var(--color-text); }
:root[data-theme="dark"] .mark-group-title,
:root[data-theme="dark"] .md-body blockquote { color: var(--color-text-muted); }
:root[data-theme="dark"] .table th,
:root[data-theme="dark"] .md-body th { background: var(--color-surface-alt); color: var(--color-text); }
:root[data-theme="dark"] .table tr:hover td { background: rgba(148, 163, 184, .08); }
:root[data-theme="dark"] .pill--neutral { background: rgba(148, 163, 184, .14); color: #cbd5e1; border-color: var(--color-border-strong); }
:root[data-theme="dark"] .readonly-banner { background: var(--color-surface-alt); color: var(--color-text-muted); border-color: var(--color-border-strong); }
:root[data-theme="dark"] .md-body code,
:root[data-theme="dark"] .accept-cell { background: var(--color-surface-alt); }
:root[data-theme="dark"] .icon-btn:hover,
:root[data-theme="dark"] .voice-btn:hover { background: rgba(148, 163, 184, .14); }
:root[data-theme="dark"] .icon-btn.is-disabled { color: #4b5d70; }
:root[data-theme="dark"] .seg-btn.is-active,
:root[data-theme="dark"] .auto-opt:has(input:checked) { background: var(--brand-teal); border-color: var(--brand-teal); color: #fff; }
:root[data-theme="dark"] .progress,
:root[data-theme="dark"] .skeleton { background: var(--color-surface-alt); }
:root[data-theme="dark"] .login-wrap,
:root[data-theme="dark"] .auto-wrap { background: linear-gradient(160deg, #0f2233, var(--color-bg)); }
:root[data-theme="dark"] .doc-header { border-bottom-color: var(--color-border-strong); }

/* ---------- Celular (v0.11.0): cabeçalho em duas linhas arrumadas; "Por linha" some quando só cabe 1 card ---------- */
@media (max-width: 640px) {
  .page-header { flex-wrap: wrap; gap: var(--space-2); min-height: 0; }
  .page-header > .row-flex:first-child { flex: 1 1 100%; flex-wrap: nowrap; min-width: 0; }
  .page-header > .row-flex:first-child strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .page-header > .row-flex:last-child { flex: 1 1 100%; justify-content: flex-end; flex-wrap: wrap; gap: var(--space-2); }
  .page-header > .row-flex:last-child > .muted { display: none; }
  .page-header .env-badge { padding: 2px 8px; font-size: 10px; letter-spacing: .04em; }
}
@media (max-width: 480px) { .pac-perline { display: none; } }
