@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap');

/* Acessibilidade: pular navegação repetida */
.skip-link {
  position: absolute; left: 12px; top: 0; z-index: 10000;
  padding: 8px 14px; border-radius: 0 0 8px 8px;
  background: #111520; color: #fff; font-size: 14px; font-weight: 600;
  text-decoration: none; transform: translateY(-120%);
  transition: transform .15s ease;
}
.skip-link:focus { transform: translateY(0); outline: 2px solid #fff; outline-offset: 2px; }
#conteudo-principal:focus { outline: none; }

:root {
  --cfo-red: #8D0F12;
  --cfo-red-light: #a82528;
  --cfo-red-dark: #6b0a0d;
  --cfo-gray-50: #F6F6F6;
  --cfo-gray-100: #edeef1;
  --cfo-gray-200: #dcdee3;
  --cfo-gray-400: #959aab;
  --cfo-gray-600: #4d5568;
  --cfo-gray-700: #3a4152;
  --cfo-gray-800: #1f2533;
  --cfo-gray-900: #111520;

  /* Conteúdo das páginas (.app-page) */
  --bg: #f7f7f8;
  --surface: #ffffff;
  --ink: #1c2130;
  --ink-2: #4a5162;
  --muted: #8e93a1;
  --line: #ececef;
  --line-strong: #d8d9de;
  --track: #e9e9ec;
  --field: #f5f5f7;
  --red: var(--cfo-red);
  --red-soft: #f8eeee;
  --ok: #1e6b3a;
  --ok-soft: #e8f3ec;
  --warn: #8a5a00;
  --warn-soft: #fbf1dc;
  --danger-soft: #f8e5e5;

  --font: 'Poppins', system-ui, -apple-system, "Segoe UI", sans-serif;
  --fs-h1: clamp(1.7rem, 3.4vw, 2.4rem);
  --fs-title: 16px;
  --fs-body: 14px;
  --fs-small: 13px;
  --fs-meta: 12px;
  --fs-eyebrow: 11px;
  --ls-eyebrow: .08em;

  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-pill: 999px;

  --space-page: 56px;
  --space-section: 64px;
  --space-lower: 72px;
  --gap-cols: 56px;

  --shadow-hover: 0 12px 32px -16px rgba(17, 21, 32, .22);
  --shadow-cta: 0 8px 20px -8px rgba(141, 15, 18, .55);
  --shadow-cta-hover: 0 12px 24px -10px rgba(141, 15, 18, .6);
  --focus-ring: 0 0 0 3px rgba(141, 15, 18, .12);

  /* Identificação Anvisa por tipo: ponto (--c) e ícone (--c-ink) */
  --tipo-clinico: #8D0F12;
  --tipo-simples: #4F6D8A;
  --tipo-retencao: #3F8A5A;
  --tipo-rce: #8A8F9C;
  --tipo-rce-ink: #6d7280;
  --tipo-nr-b: #4A8FD0;
  --tipo-nr-a: #D9AE1E;
  --tipo-nr-a-ink: #B88E0C;
}

* { box-sizing: border-box; }

html { height: 100%; }

body.app-modern {
  font-family: 'Poppins', sans-serif;
  background: var(--bg);
  color: var(--cfo-gray-800);
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body.app-modern > main {
  flex: 1;
}

/* ── Top Bar ── */
.app-topbar {
  background: linear-gradient(135deg, var(--cfo-gray-900) 0%, #1a1f2e 50%, var(--cfo-red-dark) 100%);
  padding: 0.75rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
}
.app-topbar .container { display: flex; align-items: center; justify-content: space-between; }
.app-topbar .logo img { height: 36px; }
.app-topbar .nav-links { display: flex; align-items: center; gap: 0.25rem; }
.app-topbar .nav-links a {
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 0.75rem;
  transition: all 0.2s;
}
.app-topbar .nav-links a:hover { color: #fff; background: rgba(255,255,255,0.08); }
.app-topbar .nav-links a.active { color: #fff; background: rgba(255,255,255,0.1); }
.app-topbar .btn-logout {
  color: rgba(255,255,255,0.5);
  font-size: 12px;
  font-weight: 500;
  padding: 0.4rem 1rem;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 0.75rem;
  text-decoration: none;
  transition: all 0.2s;
}
.app-topbar .btn-logout:hover { color: #fff; border-color: rgba(255,255,255,0.3); background: rgba(255,255,255,0.05); }

/* ── User Info Bar ── */
.app-userbar {
  background: white;
  border-bottom: 1px solid var(--cfo-gray-200);
  padding: 0.875rem 0;
}
.app-userbar .container { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.75rem; }
.app-userbar .user-info { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
.app-userbar .user-info .info-item { display: flex; align-items: center; gap: 0.4rem; font-size: 13px; color: var(--cfo-gray-600); }
.app-userbar .user-info .info-item strong { color: var(--cfo-gray-800); font-weight: 600; }
.app-userbar .user-avatar,
.user-avatar {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--cfo-red), var(--cfo-red-light));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 14px;
}
.app-userbar .dropdown-toggle { font-size: 13px; font-weight: 500; color: var(--cfo-gray-600); text-decoration: none; }
.app-userbar .dropdown-toggle:hover { color: var(--cfo-red); }

/* ── Footer ── */
.app-footer {
  background: var(--cfo-gray-900);
  color: rgba(255,255,255,0.4);
  padding: 1.5rem 0;
  font-size: 12px;
  text-align: center;
  margin-top: auto;
}

/* ── Mobile Hamburger Menu ── */
.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  color: rgba(255,255,255,0.8);
  font-size: 22px;
  cursor: pointer;
  padding: 0.4rem;
  line-height: 1;
  transition: color 0.2s;
}
.mobile-menu-toggle:hover { color: #fff; }

.mobile-menu-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(17, 21, 32, 0.97);
  z-index: 9999;
  flex-direction: column;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.mobile-menu-overlay.open {
  display: flex;
  opacity: 1;
}

.mobile-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.mobile-menu-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: 24px;
  cursor: pointer;
  padding: 0.4rem;
  transition: color 0.2s;
}
.mobile-menu-close:hover { color: #fff; }

.mobile-menu-nav {
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1.25rem;
  gap: 0.25rem;
  flex: 1;
  overflow-y: auto;
}
.mobile-menu-nav a {
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-size: 16px;
  font-weight: 500;
  padding: 0.9rem 1rem;
  border-radius: 0.75rem;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.mobile-menu-nav a:hover { color: #fff; background: rgba(255,255,255,0.06); }
.mobile-menu-nav a.active { color: #fff; background: rgba(255,255,255,0.1); }
.mobile-menu-nav a i { width: 20px; text-align: center; font-size: 15px; }

.mobile-menu-divider {
  height: 1px;
  background: rgba(255,255,255,0.08);
  margin: 0.75rem 0;
}

.mobile-menu-logout {
  color: rgba(255,100,100,0.8) !important;
}
.mobile-menu-logout:hover {
  color: #ff6b6b !important;
  background: rgba(255,100,100,0.08) !important;
}

.mobile-menu-login {
  color: rgba(100,200,150,0.9) !important;
}
.mobile-menu-login:hover {
  color: #6fcf97 !important;
  background: rgba(100,200,150,0.08) !important;
}


/* ── Menu: responsivo ── */
@media (max-width: 768px) {
  .app-topbar .nav-links { display: none; }
  .mobile-menu-toggle { display: block; }
  .app-userbar .user-info {
    width: 100%;
    justify-content: center;
    column-gap: 1rem;
    row-gap: 0.75rem;
  }
  .app-userbar .user-cro {
    flex: 0 0 100%;
    justify-content: center;
    text-align: center;
  }
}

/* ══════════════════════════════════════════════════════════════════
   Conteúdo das páginas (.app-page). O menu e a barra do profissional
   ficam acima e não dependem de nada daqui para baixo.
   ══════════════════════════════════════════════════════════════════ */

/* ── Layout ── */
.app-page {
  padding: var(--space-page) 0 80px;
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}
.app-page .container { max-width: 1120px; padding-inline: 24px; }
.app-page .container.is-media { max-width: 920px; }
.app-page .container.is-estreita { max-width: 800px; }
.app-page a:focus-visible,
.app-page button:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }

.text-cfo { color: var(--red); }
.ico { width: 16px; height: 16px; flex-shrink: 0; }
.ico-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.stack > * + * { margin-top: 24px; }

/* ── Cabeçalho de página ── */
.page-header { margin-bottom: 48px; }
.page-header-row {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 24px 32px; flex-wrap: wrap;
}
.page-header .breadcrumb-custom {
  display: flex; align-items: center; gap: .5rem;
  margin-bottom: 12px;
  font-size: var(--fs-meta); color: var(--muted);
}
.page-header .breadcrumb-custom a { color: var(--ink-2); text-decoration: none; }
.page-header .breadcrumb-custom a:hover { color: var(--red); }
.page-header .breadcrumb-custom span { color: var(--muted); }
.page-header h1 {
  margin: 0 0 10px;
  font-size: var(--fs-h1); font-weight: 300; letter-spacing: -.02em; line-height: 1.2;
  color: var(--ink);
  text-wrap: balance;
}
.page-header p { margin: 0; max-width: 62ch; font-size: var(--fs-body); line-height: 1.6; color: var(--muted); }

/* ── Títulos de seção e rótulos ── */
.section-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
  margin-bottom: 18px;
}
.section-head h2 {
  margin: 0;
  font-size: var(--fs-title); font-weight: 600; letter-spacing: -.01em;
  color: var(--ink);
}
.section-head a { font-size: var(--fs-small); font-weight: 500; color: var(--red); text-decoration: none; }
.section-head a:hover { text-decoration: underline; }

.eyebrow {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  margin-bottom: 10px;
  font-size: var(--fs-eyebrow); font-weight: 500; letter-spacing: var(--ls-eyebrow); text-transform: uppercase;
  color: var(--muted);
}
.eyebrow em { font-style: normal; letter-spacing: .02em; text-transform: none; color: var(--red); }

/* ── Superfícies ── */
.modern-card {
  background: var(--surface);
  border: 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: box-shadow .2s;
}
.modern-card:hover { box-shadow: var(--shadow-hover); }
.modern-card .card-body { padding: 32px; }
.surface-panel {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 6px 24px;
}

/* ── Botões ── */
.btn-cfo,
.btn-cfo-outline {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 22px;
  border-radius: var(--radius-pill);
  font-family: var(--font); font-size: var(--fs-body); font-weight: 500; line-height: 1.2;
  text-align: center; text-decoration: none;
  cursor: pointer;
  transition: transform .2s, box-shadow .2s, background-color .2s, border-color .2s, color .2s;
}
.btn-cfo {
  background: var(--red);
  color: #fff;
  border: 1px solid transparent;
  box-shadow: var(--shadow-cta);
}
.btn-cfo:hover { color: #fff; transform: translateY(-1px); box-shadow: var(--shadow-cta-hover); }
.btn-cfo-outline {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn-cfo-outline:hover { color: var(--ink); border-color: var(--line-strong); }
.btn-cfo-outline.is-perigo { color: var(--red); }
.btn-cfo-outline.is-perigo:hover { color: var(--red); background: var(--red-soft); border-color: transparent; }
.btn-cfo.is-sm,
.btn-cfo-outline.is-sm { min-height: 34px; padding: 0 16px; gap: 6px; font-size: var(--fs-meta); }
.btn-cfo.is-sm { box-shadow: none; }
.btn-cfo.is-bloco { width: 100%; }
.btn-cfo:disabled { opacity: .35; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-soft {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 46px; padding: 0 20px;
  border: 0; border-radius: var(--radius-pill);
  background: var(--red-soft); color: var(--red);
  font-family: var(--font); font-size: var(--fs-body); font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .15s;
}
.btn-soft:hover { background: #f2e0e0; color: var(--red); }

.btn-icon {
  width: 36px; height: 36px;
  flex-shrink: 0;
  display: inline-grid; place-items: center;
  padding: 0;
  border: 0; border-radius: 50%;
  background: transparent;
  color: var(--muted);
  text-decoration: none;
  cursor: pointer;
  transition: background-color .15s, color .15s;
}
.btn-icon:hover { background: var(--red-soft); color: var(--red); }

/* ── Identificação do tipo (cor Anvisa) ── */
.tipo-clinico  { --c: var(--tipo-clinico); }
.tipo-simples  { --c: var(--tipo-simples); }
.tipo-retencao { --c: var(--tipo-retencao); }
.tipo-rce      { --c: var(--tipo-rce); --c-ink: var(--tipo-rce-ink); }
.tipo-nr-b     { --c: var(--tipo-nr-b); }
.tipo-nr-a     { --c: var(--tipo-nr-a); --c-ink: var(--tipo-nr-a-ink); }

.tipo-chip {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 11.5px; color: var(--ink-2);
  white-space: nowrap;
  vertical-align: middle;
}
.tipo-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--red)); flex-shrink: 0; }
.tipo-icon {
  width: 34px; height: 34px;
  flex-shrink: 0;
  display: grid; place-items: center;
  border-radius: var(--radius-sm);
  background: var(--bg);
  background: color-mix(in srgb, var(--c, var(--red)) 7%, var(--bg));
  color: var(--c-ink, var(--c, var(--red)));
}
.tipo-icon .ico { width: 17px; height: 17px; }

/* ── Listas, vazios e barras ── */
.list-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.list-row-body { flex: 1; min-width: 0; }
.list-row-title {
  font-size: var(--fs-small); font-weight: 500; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.list-row-meta { margin-top: 2px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.avatar {
  width: 34px; height: 34px;
  flex-shrink: 0;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--surface);
  font-size: var(--fs-small); font-weight: 500; color: var(--ink-2);
}

.empty-note { padding: 28px 0; font-size: var(--fs-small); line-height: 1.6; color: var(--muted); }
.empty-note p { margin: 0; }
.empty-note a:not([class]) { display: inline-block; margin-top: 8px; font-weight: 500; color: var(--red); text-decoration: none; }
.empty-note a:not([class]):hover { text-decoration: underline; }
.empty-note.is-centro {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  padding: 48px 0;
  text-align: center;
}

.bar { padding: 9px 0; }
.bar-label {
  display: flex; justify-content: space-between; gap: 12px;
  margin-bottom: 7px;
  font-size: var(--fs-meta); color: var(--ink-2);
}
.bar-label b { font-weight: 500; color: var(--ink); font-variant-numeric: tabular-nums; }
.bar-track {
  display: block;
  width: 100%; height: 4px;
  border: 0; border-radius: 4px;
  background: var(--track);
  color: var(--red);
  overflow: hidden;
  -webkit-appearance: none;
  appearance: none;
}
.bar-track::-webkit-progress-bar { background: var(--track); border-radius: 4px; }
.bar-track::-webkit-progress-value { background: var(--red); border-radius: 4px; }
.bar-track::-moz-progress-bar { background: var(--red); border-radius: 4px; }

/* ── Status e avisos ── */
.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-meta); font-weight: 500;
  white-space: nowrap;
}
.status-pill.is-ok { background: var(--ok-soft); color: var(--ok); }
.status-pill.is-alerta { background: var(--warn-soft); color: var(--warn); }
.status-pill.is-erro { background: var(--danger-soft); color: var(--red); }

.flash {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 24px; padding: 14px 20px;
  border-radius: var(--radius);
  font-size: var(--fs-small); color: var(--ink-2);
  transition: opacity .5s ease;
}
.flash.is-ok { background: var(--ok-soft); }
.flash.is-ok > i { color: var(--ok); }
.flash.is-erro { background: var(--danger-soft); }
.flash.is-erro > i { color: var(--red); }
.flash.is-alerta { background: var(--warn-soft); }
.flash p { margin: 0; }

.nota {
  margin-top: 24px; padding: 16px 20px;
  border-radius: var(--radius);
  background: var(--bg);
  font-size: var(--fs-small); line-height: 1.6; color: var(--ink-2);
}
.nota a { color: var(--red); font-weight: 500; text-decoration: none; }
.nota a:hover { text-decoration: underline; }

/* ── Formulários ── */
.modern-form .form-label {
  margin-bottom: 6px;
  font-size: var(--fs-small); font-weight: 500; color: var(--ink-2);
}
.modern-form .form-control {
  min-height: 46px;
  padding: .7rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  font-family: var(--font); font-size: var(--fs-body);
  transition: border-color .2s, box-shadow .2s, background-color .2s;
}
.modern-form .form-control:focus {
  border-color: var(--red);
  box-shadow: var(--focus-ring);
  background: var(--surface);
}
.modern-form .form-control[readonly] { background: var(--bg); border-color: transparent; color: var(--ink-2); }
.modern-form textarea.form-control { min-height: 140px; resize: vertical; }
.modern-form .form-check-input:checked { background-color: var(--red); border-color: var(--red); }
.modern-form .form-section-title,
.form-section-title {
  margin-bottom: 20px;
  font-size: var(--fs-eyebrow); font-weight: 500; letter-spacing: var(--ls-eyebrow); text-transform: uppercase;
  color: var(--muted);
}
.form-section-title i { color: var(--red); }
.form-help { margin: -8px 0 20px; font-size: var(--fs-small); line-height: 1.6; color: var(--muted); }
.form-hint { display: block; margin-top: 6px; font-size: var(--fs-meta); color: var(--muted); }
.form-field + .form-field { margin-top: 20px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }

/* ── Inscrições (acesso) ── */
.insc-card {
  background: var(--surface);
  border: 0;
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: box-shadow .2s;
  gap: 1rem;
}
.insc-card:hover { box-shadow: var(--shadow-hover); }
.insc-card .insc-info { display: flex; align-items: center; gap: 1rem; }
.insc-card .insc-badge {
  width: 48px; height: 48px;
  background: var(--red);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 600; font-size: 14px;
}
.insc-card .insc-details h6 { font-size: 15px; font-weight: 600; margin: 0; color: var(--ink); }
.insc-card .insc-details span { font-size: var(--fs-small); color: var(--muted); }
.insc-status {
  font-size: 11px; font-weight: 500;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  background: var(--ok-soft); color: var(--ok);
  text-transform: uppercase; letter-spacing: .06em;
}

/* ── Prescription Type Cards (legado) ── */
.presc-type-card {
  background: var(--surface);
  border: 0;
  border-radius: var(--radius-lg);
  padding: 2rem 1.5rem;
  text-align: center;
  text-decoration: none;
  color: inherit;
  transition: box-shadow .2s, transform .2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  cursor: pointer;
}
.presc-type-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); color: inherit; }
.presc-type-card .icon-wrapper {
  width: 72px; height: 72px;
  border-radius: var(--radius-lg);
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
}
.presc-type-card .icon-wrapper img { width: 40px; height: 40px; object-fit: contain; }
.presc-type-card h5 { font-size: 15px; font-weight: 600; margin: 0; color: var(--ink); }
.presc-type-card p { font-size: var(--fs-small); color: var(--muted); margin: 0; line-height: 1.5; }

/* ── Cartão lateral da conta gov.br ── */
.app-page .container:has(> .govbr-acesso) {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.app-page .container.is-media:has(> .govbr-acesso),
.app-page .container.is-estreita:has(> .govbr-acesso) { max-width: 1120px; }
.app-page .container:has(> .govbr-acesso) > * { order: 1; min-width: 0; }
.app-page .container:has(> .govbr-acesso) > .dash-hello,
.app-page .container:has(> .govbr-acesso) > .page-header { order: -1; }
.app-page .container:has(> .govbr-acesso) > .govbr-acesso { order: 0; }
.app-page.dash .container:has(> .govbr-acesso) > .dash-stats { margin: 0; }
.app-page.dash .container:has(> .govbr-acesso) > .dash-cols { margin-top: 16px; align-items: start; }
.app-page.dash .container:has(> .govbr-acesso) .recent-list.is-cheia { justify-content: flex-start; }

@media (min-width: 960px) {
  /* Emitidas, validar, perfil: cartão à direita do conteúdo. */
  .app-page .container:has(> .govbr-acesso) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    column-gap: 32px;
    row-gap: 0;
    align-items: start;
  }
  /* row-gap 0: as linhas vazias do span do cartão não ocupam altura. */
  .app-page .container:has(> .govbr-acesso) > * { grid-column: 1; }
  .app-page .container:has(> .govbr-acesso) > :not(.govbr-acesso) + :not(.govbr-acesso) { margin-top: 24px; }
  .app-page .container:has(> .govbr-acesso) > .page-header { grid-column: 1 / -1; grid-row: 1; }
  .app-page .container:has(> .govbr-acesso) > .govbr-acesso {
    grid-column: 2;
    grid-row: 2 / span 20;
    position: sticky;
    top: 76px;
  }

  /* Painel: cartão ao lado só da saudação e dos números; listas embaixo, largura toda. */
  .app-page.dash .container:has(> .govbr-acesso) {
    grid-template-columns: minmax(0, 1fr) 320px;
    column-gap: 40px;
    row-gap: 0;
  }
  .app-page.dash .container:has(> .govbr-acesso) > * { grid-column: 1 / -1; }
  .app-page.dash .container:has(> .govbr-acesso) > .dash-hello { grid-column: 1; grid-row: 1; align-self: start; }
  .app-page.dash .container:has(> .govbr-acesso) > .dash-stats { grid-column: 1; grid-row: 2; align-self: end; margin: 28px 0 0; }
  .app-page.dash .container:has(> .govbr-acesso) > .govbr-acesso { grid-column: 2; grid-row: 1 / span 2; position: static; align-self: start; }
  .app-page.dash .container:has(> .govbr-acesso) > .dash-cols { margin-top: var(--space-section); }
  .app-page.dash .container:has(> .govbr-acesso) .dash-hello { flex-wrap: wrap; gap: 16px 24px; }
}

.govbr-acesso {
  padding: 18px 18px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(28, 33, 48, .04), 0 8px 24px rgba(28, 33, 48, .04);
}
.govbr-acesso__topo { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.govbr-acesso__logo { display: block; width: auto; height: 20px; }
.govbr-acesso__nivel {
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-eyebrow); font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  background: var(--field); color: var(--ink-2);
}
.govbr-acesso__nivel.is-ouro { background: #fbf1d6; color: #8a6400; }
.govbr-acesso__nivel.is-prata { background: #eef0f3; color: #4d5568; }
.govbr-acesso__nivel.is-bronze { background: #f6e9df; color: #8a4b1f; }
.govbr-acesso h2 { margin: 0 0 4px; font-size: 1.05rem; font-weight: 600; line-height: 1.3; color: var(--ink); }
.govbr-acesso__resumo { margin: 0 0 12px; font-size: var(--fs-small); line-height: 1.5; color: var(--ink-2); }
.govbr-acesso__resumo b { font-weight: 600; color: var(--ink); }
.govbr-acesso__lista { margin: 0 0 12px; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.govbr-acesso__lista li {
  display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 8px; align-items: start;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-small); line-height: 1.35;
}
.govbr-acesso__lista li i { margin-top: 2px; font-size: 12px; text-align: center; }
.govbr-acesso__lista li.is-ok i { color: var(--ok); }
.govbr-acesso__lista li.is-nao i { color: var(--muted); }
.govbr-acesso__lista li b { display: block; font-weight: 500; color: var(--ink); }
.govbr-acesso__lista li.is-nao b { color: var(--ink-2); }
.govbr-acesso__lista li small { display: block; margin-top: 2px; font-size: var(--fs-meta); color: var(--muted); }
.govbr-acesso__acoes { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.govbr-acesso__link { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-small); font-weight: 500; color: var(--red); text-decoration: none; }
.govbr-acesso__link:hover { text-decoration: underline; }
.govbr-acesso__link i { font-size: 11px; }

/* Chip "gov.br · conta bronze" no menu escuro */
.nav-govbr-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, .12);
  font-size: 12px; font-weight: 500; white-space: nowrap;
  color: #fff;
}

/* ══ Dashboard ══ */
.dash-hello { display: flex; justify-content: space-between; align-items: center; gap: 32px; }
.dash-hello > div:first-child { flex: 1 1 auto; min-width: 0; }
.dash-when { margin: 0 0 10px; font-size: var(--fs-small); color: var(--muted); }
.dash-hello h1 {
  margin: 0;
  font-size: var(--fs-h1); font-weight: 300; letter-spacing: -.02em; line-height: 1.2;
  color: var(--ink);
  text-wrap: balance;
}
.dash-hello h1 strong { font-weight: 600; }
.dash-cro { margin: 10px 0 0; font-size: var(--fs-small); color: var(--muted); }
.dash-cro b { font-weight: 500; color: var(--ink-2); }
.dash-actions { flex-shrink: 0; display: flex; gap: 10px; }

.dash-stats {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: var(--space-page) 0 var(--space-section);
  padding: 28px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.dash-stat { min-width: 0; padding: 0 28px; border-left: 1px solid var(--line); }
.dash-stat:first-child { padding-left: 0; border-left: 0; }
.dash-stat-n {
  font-size: 2.4rem; font-weight: 300; letter-spacing: -.03em; line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.dash-stat-l { margin-top: 10px; font-size: var(--fs-meta); color: var(--muted); }
.dash-stat.is-destaque .dash-stat-n { color: var(--red); }

.dash-cols {
  display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: var(--gap-cols);
  align-items: stretch;
}
.dash-cols.is-unica { grid-template-columns: minmax(0, 1fr); }
.dash-recentes { display: flex; flex-direction: column; min-width: 0; }

.recent-list { flex: 1; display: flex; flex-direction: column; }
.recent-list.is-cheia { justify-content: space-between; }
.recent-row {
  display: grid; grid-template-columns: 76px minmax(0, 1fr) auto 36px;
  align-items: center; gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.recent-row:last-child { border-bottom: 0; }
.recent-date { font-size: var(--fs-small); font-weight: 500; font-variant-numeric: tabular-nums; }
.recent-date span { display: block; font-size: 11px; font-weight: 400; color: var(--muted); }
.recent-pac {
  font-size: var(--fs-body); font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.quick-group + .quick-group { margin-top: 26px; }
.quick-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.quick-tile {
  position: relative;
  min-width: 0;
  display: flex; align-items: center; gap: 12px;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  transition: box-shadow .2s, transform .2s;
}
.quick-tile:hover { color: var(--ink); transform: translateY(-1px); box-shadow: var(--shadow-hover); }
.quick-tile-text { min-width: 0; font-size: var(--fs-small); font-weight: 500; line-height: 1.3; }
.quick-tile-text small { display: block; margin-top: 2px; font-size: 11px; font-weight: 400; color: var(--muted); }
.quick-tile-lock { position: absolute; top: 10px; right: 10px; width: 12px; height: 12px; color: var(--muted); }
.quick-tile.is-bloqueado { opacity: .55; }
.quick-tile.is-bloqueado:hover { transform: none; box-shadow: none; }

.dash-lower {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--gap-cols);
  margin-top: var(--space-lower);
  padding-top: 48px;
  border-top: 1px solid var(--line);
}
.dash-lower .list-row .btn-cfo-outline { flex-shrink: 0; }

/* ══ Emitir: seleção do tipo ══ */
.ps-ajuda-btn i { color: var(--red); }

.ps-status {
  display: flex; align-items: center; gap: 16px;
  margin-bottom: var(--space-section);
  padding: 14px 20px 14px 14px;
  border-radius: var(--radius);
  background: var(--surface);
}
.ps-status p { flex: 1; margin: 0; font-size: var(--fs-small); line-height: 1.5; color: var(--ink-2); }
.ps-status p strong { font-weight: 600; color: var(--ink); }
.ps-status-pill {
  flex-shrink: 0;
  display: inline-flex; align-items: center; gap: .45rem;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-meta); font-weight: 500;
  white-space: nowrap;
}
.ps-status-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.ps-status.is-on .ps-status-pill { background: var(--ok-soft); color: var(--ok); }
.ps-status.is-transicao .ps-status-pill { background: var(--warn-soft); color: var(--warn); }
.ps-status.is-off .ps-status-pill { background: var(--danger-soft); color: var(--red); }
.ps-status-link { flex-shrink: 0; font-size: var(--fs-small); font-weight: 500; color: var(--red); text-decoration: none; white-space: nowrap; }
.ps-status-link i { margin-left: .3rem; font-size: 10px; transition: transform .15s; }
.ps-status-link:hover { color: var(--red); }
.ps-status-link:hover i { transform: translateX(2px); }
.ps-status-curto { display: none; }

.ps-paciente {
  display: flex; align-items: center; gap: 14px;
  margin: calc(var(--space-section) * -0.5) 0 var(--space-section);
  padding: 14px 20px;
  border-radius: var(--radius);
  background: var(--ok-soft);
  font-size: var(--fs-small); color: var(--cfo-gray-700);
}
.ps-paciente > i { font-size: 1.15rem; color: var(--ok); }
.ps-paciente strong { display: block; color: var(--ink); }
.ps-paciente > div { flex: 1; }
.ps-paciente a { flex-shrink: 0; font-weight: 500; color: var(--red); text-decoration: none; }
.ps-paciente a:hover { text-decoration: underline; }

.ps-section + .ps-section { margin-top: var(--space-section); }
.ps-section-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  margin-bottom: 18px;
}
.ps-section-head h2 {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: .25rem .6rem;
  margin: 0;
  font-size: var(--fs-title); font-weight: 600; letter-spacing: -.01em;
  color: var(--ink);
}
.ps-section-hint { font-size: var(--fs-meta); font-weight: 400; color: var(--muted); }
.ps-icp { flex-shrink: 0; font-size: var(--fs-meta); font-weight: 500; color: var(--red); white-space: nowrap; }

.ps-busca-med {
  margin-bottom: 16px;
  padding: 20px 24px;
  border-radius: var(--radius);
  background: var(--surface);
}
.ps-busca-med label {
  display: block;
  margin-bottom: 8px;
  font-size: var(--fs-eyebrow); font-weight: 500; letter-spacing: var(--ls-eyebrow); text-transform: uppercase;
  color: var(--muted);
}
.ps-busca-med .ir-legenda { margin-top: 10px; }

.ps-grid { display: grid; gap: 12px; }
.ps-grid-2, .ps-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ps-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ps-grid-3 .ps-card { position: relative; flex-direction: column; align-items: flex-start; gap: 14px; }
.ps-grid-3 .ps-card-arrow { position: absolute; top: 22px; right: 20px; }

.ps-item { position: relative; display: flex; }
.ps-item > .ps-card { flex: 1; min-width: 0; }
.ps-item.has-ajuda .ps-card { padding-right: 56px; }
.ps-item.has-ajuda .ps-card-arrow { display: none; }
.ps-help {
  position: absolute; top: 50%; right: 16px;
  transform: translateY(-50%);
  width: 28px; height: 28px;
  display: grid; place-items: center;
  padding: 0;
  border: 0; border-radius: 50%;
  background: var(--bg);
  font-size: 11px; color: var(--ink-2);
  transition: color .15s, background-color .15s;
}
.ps-help:hover,
.ps-help:focus-visible { background: var(--red-soft); color: var(--red); }
.ps-grid-3 .ps-item.has-ajuda .ps-card { padding-right: 20px; }
.ps-grid-3 .ps-help { top: 16px; transform: none; }

.ps-card {
  display: flex; align-items: center; gap: 16px;
  min-height: 92px;
  padding: 20px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  transition: box-shadow .2s, transform .2s;
}
.ps-card:hover { color: inherit; transform: translateY(-1px); box-shadow: var(--shadow-hover); }
.ps-card .tipo-icon { width: 44px; height: 44px; border-radius: 12px; }
.ps-card .tipo-icon .ico { width: 21px; height: 21px; }
.ps-card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.ps-card-title { font-size: 15px; font-weight: 500; line-height: 1.3; color: var(--ink); }
.ps-card-desc { font-size: var(--fs-meta); line-height: 1.5; color: var(--muted); }
.ps-card-arrow { flex-shrink: 0; font-size: 11px; color: var(--line-strong); transition: color .15s, transform .15s; }
.ps-card:hover .ps-card-arrow { color: var(--ink-2); transform: translateX(2px); }
.ps-item:has(.ps-sem-num) { flex-direction: column; align-items: stretch; }
.ps-sem-num {
  align-self: flex-start;
  margin: 8px 4px 0;
  font-size: var(--fs-meta);
  color: var(--red);
}
.ps-sem-num:hover { color: var(--ink); }
.ps-tag {
  display: inline-flex; align-items: center;
  margin-right: .35rem;
  padding: 1px 8px;
  border-radius: var(--radius-pill);
  background: var(--bg);
  font-size: 10.5px; font-weight: 500;
  color: var(--ink-2);
  white-space: nowrap;
  vertical-align: 1px;
}
.ps-card.is-bloqueado { background: transparent; box-shadow: none; transform: none; }
.ps-card.is-bloqueado .tipo-icon { filter: grayscale(1); opacity: .5; }
.ps-card.is-bloqueado .ps-card-title { color: var(--ink-2); }
.ps-card.is-bloqueado .ps-card-arrow { color: var(--muted); transform: none; }

.ps-footnote {
  display: flex; gap: 10px;
  margin: var(--space-lower) 0 0;
  padding-top: 28px;
  border-top: 1px solid var(--line);
  font-size: var(--fs-meta); line-height: 1.6;
  color: var(--muted);
}
.ps-footnote i { margin-top: .2rem; color: var(--muted); }
.ps-footnote strong { font-weight: 600; color: var(--ink-2); }
.ps-footnote a { color: var(--ink-2); }
.ps-footnote a:hover { color: var(--red); }

/* ══ Prescrições emitidas ══ */
.emitidas-panel { padding: 20px 24px; }
.emitidas-table {
  --bs-table-bg: transparent;
  --bs-table-hover-bg: transparent;
  --bs-table-accent-bg: transparent;
  margin: 0 !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
}
.emitidas-table thead th {
  padding: 12px 16px 12px 0 !important;
  border: 0 !important;
  border-bottom: 1px solid var(--line) !important;
  font-size: var(--fs-eyebrow); font-weight: 500; letter-spacing: var(--ls-eyebrow); text-transform: uppercase;
  color: var(--muted);
}
.emitidas-table tbody td {
  padding: 14px 16px 14px 0 !important;
  border: 0 !important;
  border-bottom: 1px solid var(--line) !important;
  vertical-align: middle;
  font-size: var(--fs-body);
  color: var(--ink);
}
.emitidas-table tbody tr:last-child td { border-bottom: 0 !important; }
.emitidas-table td.emitida-pdf,
.emitidas-table th.emitida-pdf { width: 52px; padding-right: 0 !important; text-align: right; }
.emitida-data { font-size: var(--fs-small); font-weight: 500; white-space: nowrap; font-variant-numeric: tabular-nums; }
.emitida-data span { display: block; font-size: 11px; font-weight: 400; color: var(--muted); }
.emitida-paciente { font-weight: 500; overflow-wrap: anywhere; }
.emitida-codigo {
  display: block;
  margin-top: 2px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px; font-weight: 400; letter-spacing: .03em;
  color: var(--muted);
}
.emitidas-panel .dataTables_wrapper > .row:first-child { margin-bottom: 8px; }
.emitidas-panel div.dataTables_wrapper div.dataTables_length label,
.emitidas-panel div.dataTables_wrapper div.dataTables_filter label {
  font-size: var(--fs-meta); color: var(--muted);
}
.emitidas-panel div.dataTables_wrapper div.dataTables_length select {
  min-height: 36px;
  margin: 0 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background-color: var(--bg);
  font-size: var(--fs-small);
}
.emitidas-panel div.dataTables_wrapper div.dataTables_filter input {
  min-width: 240px; height: 40px;
  margin-left: 8px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--bg);
  font-size: var(--fs-small);
}
.emitidas-panel div.dataTables_wrapper div.dataTables_filter input:focus {
  border-color: var(--red);
  box-shadow: var(--focus-ring);
  background: var(--surface);
  outline: 0;
}
.emitidas-panel div.dataTables_wrapper div.dataTables_info { padding-top: 18px; font-size: var(--fs-meta); color: var(--muted); }
.emitidas-panel div.dataTables_wrapper div.dataTables_paginate { padding-top: 12px; }
.emitidas-panel .pagination { gap: 4px; }
.emitidas-panel .pagination .page-item .page-link {
  min-width: 36px; height: 36px;
  display: inline-grid; place-items: center;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  font-size: var(--fs-meta);
  color: var(--ink-2);
  box-shadow: none;
}
.emitidas-panel .pagination .page-item .page-link:hover { background: var(--bg); color: var(--ink); }
.emitidas-panel .pagination .page-item.active .page-link { background: var(--red); color: #fff; }
.emitidas-panel .pagination .page-item.disabled .page-link { color: var(--line-strong); }

/* ══ Validar ══ */
.validar-metodos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.validar-metodos .modern-card { height: 100%; }
.validar-form { margin-bottom: var(--space-section); }
.resultado .card-body { padding: 32px; }
.resultado + .resultado { margin-top: 24px; }
.resultado-head { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.resultado-head h2 { margin: 0; font-size: var(--fs-title); font-weight: 600; color: var(--ink); }
.resultado-texto { margin: 0 0 28px; font-size: var(--fs-small); line-height: 1.6; color: var(--muted); }
.resultado-texto.is-erro { color: var(--red); }
.resultado-dados { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 32px; }
.resultado-dados dl { margin: 0; }
.resultado-dados dl > div { padding: 12px 0; border-top: 1px solid var(--line); }
.resultado-dados dt {
  font-size: var(--fs-eyebrow); font-weight: 500; letter-spacing: var(--ls-eyebrow); text-transform: uppercase;
  color: var(--muted);
}
.resultado-dados dd { margin: 4px 0 0; font-size: var(--fs-body); font-weight: 500; color: var(--ink); overflow-wrap: anywhere; }
.resultado-baixa { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.resultado-baixa .eyebrow { margin: 0; }
.resultado-rodape { margin: 24px 0 0; font-size: var(--fs-small); line-height: 1.6; color: var(--muted); }
.resultado-rodape a { color: var(--red); font-weight: 500; text-decoration: none; }
.resultado-rodape a:hover { text-decoration: underline; }
.resultado-erro { display: flex; align-items: center; gap: 12px; font-size: var(--fs-body); color: var(--ink); }
.resultado-erro.card-body { padding: 20px 24px; }

/* ══ Perfil ══ */
.logo-preview {
  max-width: 100px; max-height: 100px;
  border-radius: var(--radius);
  background: var(--bg);
  padding: 6px;
}

/* ══ Modelos (templates) ══ */
.tpl-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.tpl-card .card-body { display: flex; flex-direction: column; height: 100%; padding: 24px; }
.tpl-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.tpl-card-title { margin: 0 0 6px; font-size: 15px; font-weight: 600; color: var(--ink); }
.tpl-uso { flex-shrink: 0; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tpl-preview {
  flex: 1;
  display: -webkit-box;
  margin: 0 0 20px;
  font-size: var(--fs-small); line-height: 1.6; color: var(--ink-2);
  -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}
.tpl-actions { display: flex; align-items: center; gap: 8px; padding-top: 16px; border-top: 1px solid var(--line); }
.tpl-actions form { margin: 0 0 0 auto; }
.empty-hero { padding: 64px 32px; text-align: center; }
.empty-hero .empty-hero-icon {
  width: 72px; height: 72px;
  display: grid; place-items: center;
  margin: 0 auto 24px;
  border-radius: 50%;
  background: var(--bg);
  font-size: 26px; color: var(--muted);
}
.empty-hero h2 { margin: 0 0 8px; font-size: var(--fs-title); font-weight: 600; color: var(--ink); }
.empty-hero p { max-width: 400px; margin: 0 auto 24px; font-size: var(--fs-body); line-height: 1.6; color: var(--muted); }

.modal-cfo { border: 0; border-radius: var(--radius-lg); font-family: var(--font); }
.modal-cfo .modal-header { padding: 24px 28px 16px; border-bottom: 0; }
.modal-cfo .modal-title { font-size: var(--fs-title); font-weight: 600; }
.modal-cfo .modal-body { padding: 8px 28px 24px; }
.modal-cfo .modal-footer { gap: 8px; padding: 16px 28px 24px; border-top: 1px solid var(--line); }
.modal-cfo .modal-footer > * { margin: 0; }

/* ── Emissão (prescricao-emitir) ── */
.page-header.is-emissao { margin-bottom: 36px; }
.emit-titulo { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; margin-bottom: 6px; }
.page-header.is-emissao h1 { margin: 0; font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 400; }
.emit-modo { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.emit-modo a {
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface);
  font-size: var(--fs-meta);
  color: var(--ink-2);
}
.emit-modo a.is-ativo { border-color: var(--red); background: var(--red-soft); color: var(--red); font-weight: 600; }
.emit-modo-nota { margin: 8px 0 0; font-size: var(--fs-meta); color: var(--muted); }
.quick-sem-num { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 8px 0 0; font-size: var(--fs-meta); }
.quick-sem-num a { color: var(--red); }
.tipo-chip.is-pilula { padding: 5px 12px; border-radius: var(--radius-pill); background: var(--surface); font-size: var(--fs-meta); }

.emit-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 40px; align-items: start; }
.emit-layout.is-anvisa { grid-template-columns: minmax(0, 1fr) 320px; gap: 36px; }
.emit-main { min-width: 0; display: flex; flex-direction: column; gap: 20px; }

.emit-step { background: var(--surface); border-radius: var(--radius-lg); padding: 28px 32px 32px; }
.emit-step-head { display: flex; align-items: center; gap: 14px; margin-bottom: 24px; }
.emit-num {
  width: 30px; height: 30px; flex-shrink: 0;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--red-soft); color: var(--red);
  font-size: var(--fs-small); font-weight: 600;
}
.emit-step-head h2 { margin: 0; font-size: var(--fs-title); font-weight: 600; color: var(--ink); }
.emit-step-head p { margin: 2px 0 0; font-size: var(--fs-meta); color: var(--muted); }

.emit-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 20px 16px; }
.emit-c6 { grid-column: span 6; }
.emit-c4 { grid-column: span 4; }
.emit-c3 { grid-column: span 3; }
.emit-c2 { grid-column: span 2; }
.emit-step .form-label { display: block; margin-bottom: 8px; font-size: var(--fs-small); font-weight: 500; color: var(--ink); }
.emit-obrig { font-weight: 500; color: var(--red); }
.emit-opcional { font-weight: 400; color: var(--muted); }
.emit-step .form-control,
.emit-step .form-select {
  height: 48px; min-height: 48px;
  padding: 0 16px;
  border: 1px solid transparent; border-radius: 12px;
  background-color: var(--field);
  font-size: var(--fs-body);
  box-shadow: none;
}
.emit-step .form-select { padding-right: 40px; }
.emit-step .form-control:focus,
.emit-step .form-select:focus { border-color: var(--red); background-color: var(--surface); box-shadow: none; }
.emit-step .form-control:disabled { opacity: .5; }
.emit-step .form-control.is-invalid { border-color: var(--red); }
.emit-step textarea.form-control { height: auto; min-height: 200px; padding: 14px 16px; line-height: 1.6; resize: vertical; }
.emit-check { display: inline-flex; align-items: center; gap: 8px; margin-top: 10px; font-size: var(--fs-meta); color: var(--ink-2); cursor: pointer; }
.emit-check input { width: 16px; height: 16px; margin: 0; accent-color: var(--red); }
.emit-hint { display: flex; justify-content: space-between; gap: 12px; margin-top: 8px; font-size: var(--fs-meta); color: var(--muted); }
.emit-hint > :last-child { margin-left: auto; white-space: nowrap; font-variant-numeric: tabular-nums; }

.emit-pro {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 16px 18px;
  border-radius: var(--radius);
  background: var(--field);
}
.emit-pro strong { display: block; font-size: var(--fs-body); font-weight: 500; color: var(--ink); }
.emit-pro span { font-size: var(--fs-meta); color: var(--muted); }
.ee-opcoes.is-seg { gap: 0; margin: 0; padding: 4px; border-radius: var(--radius-pill); background: var(--surface); }
.ee-opcoes.is-seg .ee-opcao span { padding: 7px 16px; border: 0; background: transparent; font-weight: 500; color: var(--ink-2); }
.ee-opcoes.is-seg .ee-opcao span i { display: none; }
.ee-opcoes.is-seg .ee-opcao:hover span { color: var(--ink); }
.ee-opcoes.is-seg .ee-opcao input:checked + span { background: var(--ink); color: #fff; }
.ee-opcoes.is-seg .ee-opcao.is-indisponivel:hover span { color: var(--ink-2); }
.ee-preview.is-linha { margin-top: 12px; padding: 0; border: 0; background: none; font-size: var(--fs-small); color: var(--ink-2); }
.ee-preview.is-linha > i { display: none; }
.ee-preview.is-linha .ee-preview-rotulo { font-weight: 400; color: var(--muted); }
.ee-preview.is-linha.is-atualizado { animation: none; }

.emit-legal {
  margin: 0 0 16px; padding: 12px 14px;
  border-radius: 12px;
  background: var(--red-soft);
  font-size: var(--fs-meta); line-height: 1.5; color: var(--ink-2);
}
.emit-legal b { font-weight: 600; color: var(--red); }

.emit-voltar {
  align-self: flex-start;
  display: inline-flex; align-items: center; gap: 8px;
  height: 42px; padding: 0 20px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  font-size: var(--fs-small); font-weight: 500; color: var(--ink-2); text-decoration: none;
}
.emit-voltar:hover { color: var(--ink); }

.emit-side { position: sticky; top: 88px; display: flex; flex-direction: column; gap: 16px; }
.emit-box { background: var(--surface); border-radius: var(--radius-lg); padding: 24px; }
.emit-box:focus { outline: none; }
.emit-box-titulo {
  margin: 0 0 14px;
  font-size: var(--fs-eyebrow); font-weight: 500; letter-spacing: var(--ls-eyebrow); text-transform: uppercase;
  color: var(--muted);
}
.emit-etapas { display: flex; flex-direction: column; margin: 0 0 18px; padding: 0; list-style: none; }
.emit-etapa {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 9px 0;
  border: 0; background: none;
  font-family: var(--font); text-align: left;
  cursor: pointer;
}
.emit-etapas li + li .emit-etapa { border-top: 1px solid var(--line); }
.emit-etapa-marca {
  width: 26px; height: 26px; flex-shrink: 0;
  display: grid; place-items: center;
  border: 1.5px solid var(--line-strong); border-radius: 50%;
  font-size: var(--fs-meta); font-weight: 600; color: var(--muted);
  transition: background-color .2s, border-color .2s, color .2s;
}
.emit-etapa-marca .ico { display: none; width: 14px; height: 14px; }
.emit-etapa-texto { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.emit-etapa-texto strong { font-size: var(--fs-small); font-weight: 500; color: var(--ink); }
.emit-etapa-texto small { font-size: 11.5px; line-height: 1.35; color: var(--warn); }
.emit-etapa:hover strong { color: var(--red); }
.emit-etapa:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; border-radius: 8px; }
.emit-etapa.is-feita .emit-etapa-marca { border-color: var(--ok); background: var(--ok); color: #fff; }
.emit-etapa.is-feita .emit-etapa-marca span { display: none; }
.emit-etapa.is-feita .emit-etapa-marca .ico { display: block; }
.emit-etapa.is-feita small { color: var(--ok); }
.emit-num.is-feita { background: var(--ok); color: #fff; }
.emit-num .ico { width: 15px; height: 15px; }
.emit-sncr { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.emit-sncr strong { font-size: 15px; font-weight: 600; color: var(--ink); }
.emit-saldo {
  display: flex; align-items: center; gap: 14px;
  margin: 10px 0 12px; padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--ok-soft); color: var(--ok);
}
.emit-saldo-n { font-size: 2.1rem; font-weight: 300; line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.emit-saldo-rotulo { font-size: var(--fs-meta); font-weight: 500; line-height: 1.35; }
.emit-saldo.is-alerta { background: var(--warn-soft); color: var(--warn); }
.emit-texto { margin: 0 0 16px; font-size: 12.5px; line-height: 1.55; color: var(--ink-2); }
.emit-flash { margin: 0 0 16px; padding: 10px 14px; font-size: var(--fs-meta); }
.emit-pedido { display: flex; gap: 8px; }
.emit-pedido .form-select { width: auto; min-width: 76px; border-radius: var(--radius-pill); }
.emit-status { margin: 16px 0 14px; font-size: var(--fs-meta); line-height: 1.5; color: var(--muted); }
.emit-status:empty { display: none; }
.emit-status.is-pronto { color: var(--ok); }
.emit-modelo-ajuda { margin: 0 0 12px; font-size: 11.5px; line-height: 1.45; color: var(--muted); }
.emit-modelo-salvar { display: flex; gap: 8px; }
.emit-modelo-salvar .form-control { flex: 1; min-width: 0; height: 42px; font-size: var(--fs-meta); }
.emit-modelo-salvar .btn-soft { width: auto; min-height: 42px; padding: 0 16px; font-size: var(--fs-meta); }
.emit-modelo-salvar .btn-soft:disabled { opacity: .6; cursor: default; }
.emit-modelo-status { margin: 8px 0 0; font-size: 11.5px; color: var(--ok); }
.emit-modelo-status:empty { display: none; }
.emit-modelo-status.is-erro { color: var(--red); }
.emit-ajuda { margin-top: 12px; }
.emit-ajuda > summary {
  list-style: none; cursor: pointer;
  font-size: var(--fs-meta); font-weight: 500; color: var(--red); text-align: center;
}
.emit-ajuda > summary::-webkit-details-marker { display: none; }
.emit-ajuda > summary:hover { text-decoration: underline; }
.emit-ajuda ul { margin: 12px 0 0; padding-left: 1.1rem; font-size: var(--fs-meta); line-height: 1.5; color: var(--ink-2); }
.emit-ajuda .emit-pedido { margin-top: 12px; }
.emit-ajuda .ar-help-link { margin-top: 10px; }

.emit-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.emit-tabs button {
  padding: 6px 12px;
  border: 0; border-radius: var(--radius-pill);
  background: var(--field);
  font-family: var(--font); font-size: var(--fs-meta); color: var(--ink-2);
  cursor: pointer;
}
.emit-tabs button[aria-selected="true"] { background: var(--ink); color: #fff; }
.emit-lista { display: flex; flex-direction: column; max-height: 320px; overflow-y: auto; }
.emit-lista-item {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  width: 100%; padding: 11px 0;
  border: 0; border-bottom: 1px solid var(--line);
  background: none;
  font-family: var(--font); font-size: var(--fs-small); color: var(--ink); text-align: left;
  cursor: pointer;
}
.emit-lista-item:last-child { border-bottom: 0; }
.emit-lista-item:hover { color: var(--red); }
.emit-lista-nome { min-width: 0; }
.emit-lista-nome small { display: block; margin-top: 2px; font-size: 11px; color: var(--muted); }
.emit-lista-acao { flex-shrink: 0; font-size: 11px; color: var(--muted); }
.emit-lista-item:hover .emit-lista-acao { color: var(--red); }
.emit-selo {
  margin-left: 6px; padding: 1px 6px;
  border-radius: var(--radius-pill);
  background: var(--red-soft); color: var(--red);
  font-size: 10px; font-weight: 600; vertical-align: 1px;
}
.emit-mini-link { display: inline-block; margin-top: 10px; font-size: var(--fs-meta); font-weight: 500; color: var(--red); text-decoration: none; }
.emit-mini-link:hover { text-decoration: underline; }
.emit-nota { margin: 10px 0 0; font-size: 11px; line-height: 1.5; color: var(--muted); }
.emit-nota strong { font-weight: 500; color: var(--ink-2); }

.emit-reqs { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; list-style: none; font-size: 12.5px; color: var(--ink-2); }
.emit-reqs li { display: flex; align-items: flex-start; gap: 10px; line-height: 1.45; }
.emit-reqs .ico { width: 16px; height: 16px; margin-top: 1px; color: var(--ok); }
.emit-reqs li.is-alerta > i { width: 16px; margin-top: 3px; font-size: 12px; text-align: center; color: var(--warn); }
.emit-reqs small { display: block; margin-top: 2px; font-size: 11px; color: var(--muted); }

/* Endereço do emitente (também dentro do bloco Anvisa) */
.endereco-emitente { margin-bottom: .25rem; }
.ee-opcoes { display: inline-flex; gap: .35rem; flex-wrap: wrap; margin-bottom: .5rem; }
.ee-opcao { position: relative; margin: 0; cursor: pointer; }
.ee-opcao input { position: absolute; opacity: 0; pointer-events: none; }
.ee-opcao span {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .35rem .8rem; border-radius: 2rem;
  border: 1px solid var(--cfo-gray-200); background: #fff;
  font-size: 12px; font-weight: 600; color: var(--cfo-gray-600);
  transition: background .15s, border-color .15s, color .15s;
}
.ee-opcao:hover span { border-color: var(--cfo-red); }
.ee-opcao input:checked + span { background: var(--cfo-red); border-color: var(--cfo-red); color: #fff; }
.ee-opcao input:focus-visible + span { outline: 2px solid var(--cfo-red); outline-offset: 2px; }
.ee-opcao.is-indisponivel { cursor: not-allowed; opacity: .5; }
.ee-opcao.is-indisponivel:hover span { border-color: var(--cfo-gray-200); }
.ee-preview {
  display: flex; align-items: flex-start; gap: .5rem;
  padding: .5rem .7rem; border-radius: .6rem;
  background: var(--cfo-gray-50); border: 1px solid var(--cfo-gray-100);
  font-size: 12px; color: var(--cfo-gray-800); line-height: 1.4;
}
.ee-preview > i { color: var(--cfo-red); margin-top: 2px; }
.ee-preview-rotulo { color: var(--cfo-gray-400); font-weight: 600; }
.ee-preview.is-atualizado { animation: eeDestaque .9s ease; }
@keyframes eeDestaque {
  0% { background: #FBEAEA; border-color: var(--cfo-red); }
  100% { background: var(--cfo-gray-50); border-color: var(--cfo-gray-100); }
}
.ee-aviso { font-size: 11px; color: var(--cfo-gray-400); margin: .35rem 0 0; }
.ee-aviso a { color: var(--cfo-red); font-weight: 600; text-decoration: none; }

/* Bloco Anvisa (RCE, NR A, NR B): mesmo desenho do modelo eletrônico */
.aviso-art38 {
  display: flex; align-items: flex-start; gap: .4rem;
  margin: 0 0 .6rem; font-size: 11px; color: var(--cfo-gray-600); line-height: 1.4;
}
.aviso-art38 i { color: var(--cfo-gray-400); margin-top: 2px; }
.anv-paper {
  display: flex; overflow: hidden;
  margin-bottom: 1.5rem;
  border: 1px solid #222; background: #fff;
  box-shadow: 0 4px 20px rgba(0, 0, 0, .08);
}
.anv-faixa { width: 14px; flex-shrink: 0; background: #8d0f12; }
.anv-faixa.is-a { background: #F5E6A8; }
.anv-faixa.is-b { background: #A8C8E8; }
.anv-faixa.is-rce { background: #CFCFCF; }
.anv-corpo { flex: 1; padding: 1rem 1.25rem 1.25rem; }
.anv-topo { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; margin-bottom: 1rem; }
.anv-paper .anv-titulo { margin: 0; font-size: 1.05rem; font-weight: 800; letter-spacing: .02em; line-height: 1.25; text-transform: uppercase; }
.anv-num { border: 1px solid #000; padding: .5rem .75rem; min-width: 200px; }
.anv-paper .form-label.anv-num-rotulo { margin: 0; font-size: 11px; }
.anv-num-sncr { padding: .35rem 0; font-size: 12px; color: #555; }
.anv-paper .form-control.anv-num-input,
.anv-paper .form-control.anv-num-input:focus { padding-left: 0; border: none; border-bottom: 1px solid #999; border-radius: 0; }
.anv-linha { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin-bottom: .75rem; }
.anv-caixa { border: 1px solid #000; }
.anv-caixa.is-prescricao { margin-bottom: .5rem; }
.anv-caixa-titulo { padding: .35rem; background: #d0d0d0; text-align: center; font-size: 12px; font-weight: 700; }
.anv-caixa-corpo { padding: .75rem; }
.anv-paper .form-label.anv-rotulo { font-size: 10px; text-transform: uppercase; }
.anv-paper .form-check-label.anv-semcpf { font-size: 11px; }
.anv-nota-cpf { margin: 0 0 .5rem; font-size: 10px; color: #666; }
.anv-paper .anv-legenda { margin-bottom: 10px; }
.anv-legenda-sep { margin-left: 6px; }
.anv-catalogo { position: relative; }
.anv-dica { margin: 4px 0 0; font-size: 10px; color: #666; }
.anv-alertas { margin-top: 4px; }
.anv-rodape { margin: 0; font-size: 10px; color: #555; }

/* Escolha de medicamentos: catálogo regulatório (6, 7, 8) e mais usados (5, 10) */
.cat-cor-laranja  { --c: #c2410c; --c-bg: #fff7ed; --c-bd: #fdba74; }
.cat-cor-vermelha { --c: #b91c1c; --c-bg: #fef2f2; --c-bd: #fca5a5; }
.cat-cor-roxa     { --c: #6d28d9; --c-bg: #f5f3ff; --c-bd: #c4b5fd; }
.cat-cor-verde    { --c: #0f766e; --c-bg: #f0fdfa; --c-bd: #5eead4; }
.cat-cor-azul     { --c: #1d4ed8; --c-bg: #eff6ff; --c-bd: #93c5fd; }
.cat-cor-ambar    { --c: #b45309; --c-bg: #fffbeb; --c-bd: #fcd34d; }
.cat-cor-rosa     { --c: #be185d; --c-bg: #fdf2f8; --c-bd: #f9a8d4; }
.cat-cor-teal     { --c: #0e7490; --c-bg: #ecfeff; --c-bd: #67e8f9; }
.cat-cor-cinza    { --c: #475569; --c-bg: #f8fafc; --c-bd: #cbd5e1; }
.cat-cor-todos    { --c: #8d0f12; --c-bg: #fdf2f2; --c-bd: #e5a3a5; }

.cat-busca { position: relative; display: flex; align-items: center; }
.cat-busca[hidden] { display: none; }
.cat-busca > .fas { position: absolute; left: 14px; font-size: 14px; color: #94a3b8; pointer-events: none; }
.cat-busca .form-control {
  height: 46px; padding-left: 40px; padding-right: 170px;
  font-size: 14.5px; border: 1.5px solid #cbd5e1; border-radius: 10px;
}
.cat-busca .form-control:focus { border-color: #8d0f12; box-shadow: 0 0 0 3px rgba(141, 15, 18, .12); }
.cat-busca-chip {
  position: absolute; right: 10px;
  display: inline-flex; align-items: center; padding: 2px 10px;
  border: 1px solid; border-radius: 999px;
  font-size: 11px; font-weight: 600; white-space: nowrap; pointer-events: none;
}

/* Painel no fluxo da página: o .anv-paper tem overflow hidden e cortaria uma lista flutuante. */
.cat-dropdown {
  display: none;
  margin-top: 8px; overflow: hidden;
  background: #fff;
  border: 1px solid #e2e8f0; border-radius: 12px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .10);
}
.cat-topo {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 14px; background: #f8fafc; border-bottom: 1px solid #e2e8f0;
  font-size: 12.5px; font-weight: 600; color: #334155;
}
.cat-fechar { padding: 2px 8px; border: 0; border-radius: 6px; background: none; font-size: 12px; font-weight: 600; color: #64748b; cursor: pointer; }
.cat-fechar:hover { background: #e2e8f0; color: #0f172a; }
.cat-filtros { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 14px; border-bottom: 1px solid #eef2f6; }
.cat-filtro {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px;
  border: 1px solid var(--c-bd); border-radius: 999px; background: #fff;
  font-size: 12px; font-weight: 600; color: var(--c); cursor: pointer;
}
.cat-filtro b { padding: 0 6px; border-radius: 999px; background: var(--c-bg); font-size: 11px; }
.cat-filtro:hover { background: var(--c-bg); }
.cat-filtro[aria-pressed="true"] { background: var(--c); border-color: var(--c); color: #fff; }
.cat-filtro[aria-pressed="true"] b { background: rgba(255, 255, 255, .22); }
.cat-filtro-ponto,
.cat-grupo-ponto { flex-shrink: 0; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.cat-filtro[aria-pressed="true"] .cat-filtro-ponto { background: #fff; }
.cat-lista { max-height: 440px; overflow-y: auto; overscroll-behavior: contain; }
.cat-grupo {
  position: sticky; top: 0; z-index: 1;
  display: flex; align-items: center; gap: 10px; padding: 8px 14px;
  background: var(--c-bg); border-top: 1px solid var(--c-bd); border-bottom: 1px solid var(--c-bd); border-left: 4px solid var(--c);
}
.cat-lista > .cat-grupo:first-child { border-top: 0; }
.cat-grupo-txt { flex: 1; min-width: 0; }
.cat-grupo-txt strong { display: block; font-size: 12.5px; font-weight: 700; color: var(--c); }
.cat-grupo-txt small { display: block; font-size: 11.5px; line-height: 1.35; color: #475569; }
.cat-grupo-total { padding: 1px 8px; border: 1px solid var(--c-bd); border-radius: 999px; background: #fff; font-size: 11px; font-weight: 700; color: var(--c); }
.cat-itens { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; padding: 10px 12px 12px; }
.cat-itens .cat-opcao.ir-opcao {
  display: flex; flex-direction: column; gap: 6px; width: 100%; padding: 9px 11px;
  text-align: left; background: #fff; cursor: pointer;
  border: 1px solid #e2e8f0; border-left: 3px solid var(--c); border-radius: 9px;
  transition: background .12s, border-color .12s, box-shadow .12s;
}
.cat-itens .cat-opcao.ir-opcao:hover,
.cat-itens .cat-opcao.ir-opcao.is-ativo {
  background: var(--c-bg); border-color: var(--c-bd); border-left-color: var(--c);
  box-shadow: 0 2px 8px rgba(15, 23, 42, .08);
}
.cat-itens .cat-opcao.ir-opcao.is-ativo { outline: 2px solid var(--c); outline-offset: 1px; }
.cat-opcao .ir-opcao-nome { display: block; font-size: 13.5px; font-weight: 650; line-height: 1.3; color: #0f172a; }
.cat-opcao mark { padding: 0 1px; border-radius: 2px; background: #fde68a; color: inherit; }
.cat-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.cat-pill {
  display: inline-flex; align-items: center; padding: 1px 7px;
  border: 1px solid transparent; border-radius: 6px; background: #f1f5f9;
  font-size: 11.5px; font-weight: 600; color: #334155; white-space: nowrap;
}
.cat-pill.is-forma { background: #fff; border-color: #e2e8f0; font-weight: 500; color: #475569; }
.cat-pill.is-lista { background: #fff; border-color: #334155; font-weight: 700; color: #334155; }
.cat-dropdown .ir-vazio { padding: 12px 14px; font-size: 12.5px; color: #64748b; }

/* Medicamento escolhido no catálogo */
.cat-escolhido {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border: 1px solid var(--c-bd); border-left: 5px solid var(--c); border-radius: 10px; background: var(--c-bg);
}
.cat-escolhido[hidden] { display: none; }
.cat-escolhido-ic {
  display: grid; place-items: center; flex-shrink: 0; width: 40px; height: 40px;
  border: 1px solid var(--c-bd); border-radius: 10px; background: #fff; font-size: 17px; color: var(--c);
}
.cat-escolhido-txt { display: flex; flex: 1; flex-direction: column; gap: 4px; min-width: 0; }
.cat-escolhido-cat { font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--c); }
.cat-escolhido-txt strong { font-size: 16px; font-weight: 700; line-height: 1.25; color: #0f172a; }
.cat-selecionado { margin: 0; font-size: 11.5px; color: #475569; }
.cat-selecionado:empty { display: none; }
.cat-escolhido-trocar { flex-shrink: 0; background: #fff; }

/* Campos que o catálogo preenche e resumo da receita */
.anv-paper .form-label .anv-auto {
  margin-left: 4px; padding: 0 6px; border-radius: 4px; background: #f1f5f9;
  font-size: 9px; font-weight: 600; text-transform: none; color: #64748b;
}
.anv-paper .form-control.anv-auto-campo { background: #f8fafc; font-weight: 600; color: #0f172a; cursor: default; }
.anv-paper .form-control.anv-auto-campo:focus { border-color: #dee2e6; box-shadow: none; }
.anv-resumo { margin-top: 12px; padding: 10px 14px 12px; border: 1px dashed #94a3b8; border-radius: 10px; background: #fcfcfd; }
.anv-resumo-rotulo { display: block; margin-bottom: 6px; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #64748b; }
.anv-resumo-linha { margin: 0; font-size: 13.5px; line-height: 1.5; color: #0f172a; }
.anv-resumo-linha.is-sub { padding-left: 18px; font-size: 13px; }
.anv-resumo-linha.is-sub > span:first-child { color: #64748b; }
.anv-resumo .is-vazio { font-style: italic; color: #94a3b8; }

/* Mais usados do Receituário Simples e da retenção */
.cat-comuns { margin-bottom: 14px; }
.cat-comuns-aviso { margin: 8px 0 0; padding: 7px 10px; border-radius: 8px; background: #ecfdf5; font-size: 12.5px; color: #065f46; }
.cat-comuns-aviso.is-erro { background: #fef2f2; color: #991b1b; }
.cat-comuns-aviso[hidden] { display: none; }
@media (max-width: 575.98px) {
  .cat-busca-chip { display: none; }
  .cat-busca .form-control { padding-right: 12px; }
}
.cat-aviso { padding: 10px 14px; font-size: 12.5px; line-height: 1.5; color: #334155; border-bottom: 1px solid #f0f0f0; }
.cat-aviso:last-child { border-bottom: 0; }
.cat-aviso .ir-chip { margin: 0 2px; vertical-align: 1px; }
.cat-aviso a { display: inline-block; margin-left: 4px; font-weight: 700; color: var(--cfo-red, #8D0F12); text-decoration: none; }
.cat-aviso a:hover { text-decoration: underline; }
.ir-cor-neutra { background: #f8fafc; border-color: #94a3b8; color: #334155; }

/* Alertas de interação medicamentosa */
.inter-titulo { margin-bottom: 6px; font-size: 11px; font-weight: 600; text-transform: uppercase; color: var(--cfo-gray-400); }
.inter-alerta { margin-bottom: 6px; padding: 8px 12px; border: 1px solid; border-radius: 8px; color: var(--inter-texto); }
.inter-alerta.is-grave { --inter-texto: #991b1b; background: #fee2e2; border-color: #fca5a5; }
.inter-alerta.is-moderada { --inter-texto: #92400e; background: #fef3c7; border-color: #fcd34d; }
.inter-alerta.is-leve { --inter-texto: #1e40af; background: #dbeafe; border-color: #93c5fd; }
.inter-alerta-topo { display: flex; align-items: center; gap: 6px; }
.inter-alerta-topo b { font-size: 11px; }
.inter-alerta-topo span { font-size: 12px; font-weight: 600; color: var(--cfo-gray-800); }
.inter-alerta p { margin: 4px 0 0; font-size: 11px; }
.inter-alerta p.inter-conduta { margin-top: 2px; font-weight: 500; }

@media (max-width: 999.98px) {
  .emit-layout,
  .emit-layout.is-anvisa { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .emit-side { position: static; order: -1; }
  .emit-box.is-apoio,
  .emit-hint-apoio { display: none; }
  /* Folha Anvisa acompanha a largura da tela (sem scroll horizontal forçado). */
  .anv-scroll { overflow-x: visible; }
  .anv-scroll .anv-paper { min-width: 0; width: 100%; }
  .anv-topo { flex-wrap: wrap; }
  .anv-num { min-width: 0; width: 100%; }
  .anv-linha { grid-template-columns: 1fr; }
  .cat-itens { grid-template-columns: 1fr; }
}

.emit-campo-aviso {
  margin: 6px 0 0; padding: 8px 10px; border-radius: 8px;
  background: #fef2f2; border: 1px solid #fecaca; color: #991b1b;
  font-size: 12.5px; line-height: 1.4;
}
.emit-campo-aviso[hidden] { display: none; }

@media (max-width: 560px) {
  .emit-step { padding: 22px 18px 24px; }
  .emit-c4,
  .emit-c3,
  .emit-c2 { grid-column: span 6; }
  .emit-hint { flex-wrap: wrap; }
}

/* ── Responsive ── */
@media (max-width: 1024px) {
  .ps-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  :root { --space-section: 56px; --space-lower: 56px; }
  .dash-hello { flex-wrap: wrap; }
  .dash-actions { flex-wrap: wrap; }
  .dash-cols,
  .dash-lower { grid-template-columns: minmax(0, 1fr); gap: 48px; }
  .recent-row:nth-child(n+6) { display: none; }
  .recent-row:nth-child(5) { border-bottom: 0; }
  .dash-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 28px; }
  .dash-stat:nth-child(3) { padding-left: 0; border-left: 0; }
  .validar-metodos,
  .resultado-dados,
  .tpl-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 768px) {
  .insc-card { flex-direction: column; text-align: center; }
  .insc-card .insc-info { flex-direction: column; }
  .modern-card .card-body,
  .resultado .card-body { padding: 24px; }
  .govbr-vo-banner__inner { padding: 24px; }

  .emitidas-panel { padding: 16px; }
  .emitidas-panel .table-responsive { overflow: visible; }
  .emitidas-panel .dataTables_wrapper > .row { --bs-gutter-x: 0; margin: 0; }
  .emitidas-panel .dataTables_wrapper > .row > [class*="col-"] { flex: 0 0 auto; width: 100%; max-width: 100%; padding: 0; }
  .emitidas-panel .dataTables_wrapper > .row:first-child { display: grid; gap: 12px; margin-bottom: 8px; }
  .emitidas-panel div.dataTables_wrapper div.dataTables_filter { text-align: left; }
  .emitidas-panel div.dataTables_wrapper div.dataTables_filter label { display: block; width: 100%; }
  .emitidas-panel div.dataTables_wrapper div.dataTables_filter input {
    display: block; width: 100%; min-width: 0; height: 44px;
    margin: 8px 0 0;
    font-size: 16px;
  }
  .emitidas-panel div.dataTables_wrapper div.dataTables_length { text-align: left; }
  .emitidas-panel div.dataTables_wrapper div.dataTables_info,
  .emitidas-panel div.dataTables_wrapper div.dataTables_paginate { text-align: center; }
  .emitidas-panel .pagination { flex-wrap: wrap; justify-content: center !important; }

  .emitidas-table,
  .emitidas-table tbody { display: block; width: 100% !important; }
  .emitidas-table thead {
    position: absolute;
    width: 1px; height: 1px;
    margin: -1px; padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  table.dataTable.emitidas-table > tbody > tr {
    display: grid;
    grid-template-columns: 84px minmax(0, 1fr) 36px;
    grid-template-areas:
      "data paciente pdf"
      "data tipo pdf";
    align-items: center;
    gap: 4px 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
    background: transparent !important;
  }
  table.dataTable.emitidas-table > tbody > tr:last-child { border-bottom: 0; }
  table.dataTable.emitidas-table > tbody > tr > td {
    display: block;
    min-width: 0;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }
  .emitidas-table .emitida-data { grid-area: data; align-self: start; }
  .emitidas-table .emitida-paciente { grid-area: paciente; }
  .emitidas-table .emitida-tipo { grid-area: tipo; }
  .emitidas-table .emitida-pdf { grid-area: pdf; width: auto; }
  .emitidas-table td.dataTables_empty {
    grid-column: 1 / -1; grid-row: 1 / -1;
    padding: 32px 16px !important;
    text-align: center !important;
    color: var(--muted);
  }

  .ps-status { flex-wrap: wrap; justify-content: space-between; row-gap: 10px; }
  .ps-status p { flex-basis: 100%; order: 3; }
  .ps-status .ps-status-longo { display: none; }
  .ps-status .ps-status-curto { display: block; }
  .ps-section-head { flex-direction: column; align-items: flex-start; gap: 6px; }
}

@media (max-width: 640px) {
  .ps-grid { grid-template-columns: minmax(0, 1fr) !important; }
  .ps-grid-3 .ps-card { flex-direction: row; align-items: center; gap: 16px; }
  .ps-grid-3 .ps-card-arrow { position: static; }
  .ps-card { padding: 16px; }
  .ps-item.has-ajuda .ps-card,
  .ps-grid-3 .ps-item.has-ajuda .ps-card { padding-right: 48px; }
  .ps-help { right: 12px; width: 26px; height: 26px; }
  .ps-grid-3 .ps-help { top: 50%; transform: translateY(-50%); }
  .ps-ajuda-btn { width: 100%; }
  .govbr-vo-lists { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .app-page { padding: 36px 0 56px; }
  .app-page .container { padding-inline: 16px; }
  .page-header { margin-bottom: 36px; }
  .dash-actions { width: 100%; }
  .dash-actions > * { flex: 1 1 auto; }
  .dash-stats { margin: 40px 0 48px; }
  .dash-stat { padding: 0 16px; }
  .dash-stat-n { font-size: 2rem; }
  .surface-panel { padding: 4px 16px; }
  .recent-row { grid-template-columns: 64px minmax(0, 1fr) 36px; row-gap: 2px; }
  .recent-row .recent-date { grid-row: 1 / 3; align-self: start; }
  .recent-row .tipo-chip { grid-column: 2; grid-row: 2; }
  .recent-row .btn-icon { grid-column: 3; grid-row: 1 / 3; }
  .quick-tiles { grid-template-columns: minmax(0, 1fr); }
  .tpl-actions { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  .app-page *,
  .app-page *::before,
  .app-page *::after { transition: none !important; }
}

/* Nota acima da busca: catálogo curado + pedido de inclusão */
.cat-catalogo-nota {
  margin: 0 0 0.55rem;
  padding: 0.55rem 0.7rem;
  border-radius: 0.55rem;
  border: 1px solid #fde68a;
  background: #fffbeb;
  font-size: 12.5px;
  line-height: 1.45;
  color: #78350f;
}
.cat-catalogo-nota a { color: var(--cfo-red, #8D0F12); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.cat-catalogo-nota strong { font-weight: 700; color: #92400e; }

/* Pedido de inclusão no catálogo (rodapé da lista + janela) */
.cat-pedido {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px;
  padding: 10px 14px; border-top: 1px solid #e2e8f0; background: #f8fafc;
  font-size: 12.5px; color: #475569;
}
.cat-pedido-btn {
  padding: 4px 10px; border: 1px solid var(--cfo-red, #8D0F12); border-radius: 8px; background: #fff;
  font-size: 12.5px; font-weight: 700; color: var(--cfo-red, #8D0F12); cursor: pointer;
}
.cat-pedido-btn:hover, .cat-pedido-btn:focus-visible { background: var(--cfo-red, #8D0F12); color: #fff; }
.ped-dialog {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0;
  border: 0; border-radius: 14px; box-shadow: 0 20px 50px rgba(15, 23, 42, .25); color: #0f172a;
}
.ped-dialog::backdrop { background: rgba(15, 23, 42, .45); }
.ped-form { display: flex; flex-direction: column; max-height: calc(100vh - 32px); margin: 0; }
.ped-topo { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid #e2e8f0; }
.ped-titulo { margin: 0; font-size: 17px; font-weight: 700; }
.ped-fechar { padding: 0 8px; border: 0; border-radius: 6px; background: none; font-size: 22px; line-height: 1; color: #64748b; cursor: pointer; }
.ped-fechar:hover { background: #e2e8f0; color: #0f172a; }
.ped-corpo { padding: 14px 18px; overflow-y: auto; }
.ped-receita { margin: 0 0 8px; font-size: 13px; color: #475569; }
.ped-aviso { margin: 0 0 12px; padding: 8px 10px; border-radius: 8px; background: #fffbeb; font-size: 12.5px; line-height: 1.45; color: #92400e; }
.ped-campo { margin-bottom: 10px; }
.ped-campo .form-label { margin-bottom: 3px; font-size: 12.5px; font-weight: 600; }
.ped-opcional { font-weight: 400; color: #64748b; }
.ped-art38 { margin: 4px 0 0; font-size: 11.5px; color: #64748b; }
.ped-status { margin-top: 10px; padding: 8px 10px; border-radius: 8px; font-size: 12.5px; }
.ped-status.is-erro { background: #fef2f2; color: #991b1b; }
.ped-status[hidden] { display: none; }
.ped-ok { padding: 6px 0; font-size: 14px; line-height: 1.5; }
.ped-ok p { margin: 6px 0 0; color: #334155; }
.ped-rodape { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid #e2e8f0; background: #f8fafc; }
@media (max-width: 575.98px) {
  .ped-rodape { flex-direction: column-reverse; }
  .ped-rodape > button { width: 100%; }
}

/* Catálogo aberto: classificação do medicamento prescrito pelo nome */
.cat-livre { margin-top: 0.5rem; padding: 0.6rem 0.75rem; border: 1px solid; border-radius: 0.55rem; font-size: 12.5px; line-height: 1.45; }
.cat-livre[hidden] { display: none; }
.cat-livre.is-ok { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.cat-livre.is-aviso { background: #fffbeb; border-color: #fde68a; color: #78350f; }
.cat-livre.is-erro { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.cat-livre-msg { margin: 0; font-weight: 600; }
.cat-livre-acao { margin: 0.35rem 0 0; }
.cat-livre-acao[hidden], .cat-livre-conf[hidden] { display: none; }
.cat-livre-acao .ir-chip { margin: 0 2px; vertical-align: 1px; }
.cat-livre-acao a { margin-left: 4px; font-weight: 700; color: var(--cfo-red, #8D0F12); text-decoration: none; }
.cat-livre-acao a:hover { text-decoration: underline; }
.cat-livre-conf { display: flex; gap: 0.5rem; align-items: flex-start; margin: 0.5rem 0 0; font-weight: 500; color: #1f2937; cursor: pointer; }
.cat-livre-conf input { margin-top: 2px; flex: none; width: 16px; height: 16px; }
.cat-livre-opcao { background: #f8fafc; }
.cat-p344 { padding: 8px 10px; border-top: 1px solid #f0f0f0; display: flex; flex-wrap: wrap; gap: 6px; }
.cat-p344-titulo { width: 100%; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: #64748b; }
.cat-p344-item { display: inline-flex; flex-direction: column; align-items: flex-start; padding: 5px 10px; border: 1px solid #e2e8f0; border-radius: 8px; background: #fff; font-size: 12.5px; line-height: 1.25; text-align: left; cursor: pointer; }
.cat-p344-item span { font-size: 11px; color: #64748b; }
.cat-p344-item:hover, .cat-p344-item:focus-visible { border-color: var(--cfo-red, #8D0F12); background: #fff7f7; }
/* Catálogo aberto: botão fixo "Prescrever pelo nome" e opção em destaque na lista */
.cat-livre-cta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 0.45rem; font-size: 12.5px; color: #475569; }
.cat-livre-cta[hidden] { display: none; }
.cat-livre-cta .cat-pedido-btn i { margin-right: 4px; }
.cat-livre-cta.is-orientar span { font-weight: 700; color: #92400e; }
.cat-livre-destaque { border-top: 0; border-bottom: 1px solid #e2e8f0; }
.cat-livre-destaque.is-ok { background: #ecfdf5; color: #065f46; }
.cat-livre-destaque.is-aviso { background: #fffbeb; color: #78350f; }
.cat-livre-destaque > span { flex: 1 1 260px; }
