/* celular e tablet: cabeçalho, abas, aba Pacientes, ficha, cadastro, login
   Celular <= 700 px · tablet 701 a 1100 px · computador (>= 1101 px) não muda.
   Escalas usadas aqui:
   espaço 4 / 8 / 12 / 16 / 24 · texto 12 / 14 / 16 / 20 · controles 44 (lista) e 48 (formulários) */

/* elementos criados pelo mobile-lista.js: escondidos fora do celular/tablet */
.ml-menu, .ml-fx, .ml-rodape { display: none; }

/* =====================================================================
   CELULAR E TABLET (até 1100 px)
   ===================================================================== */
@media (max-width: 1100px) {
  /* ---------- cabeçalho ---------- */
  header .brand { flex: 1 1 auto; min-width: 0; }
  header .titles { min-width: 0; }
  header .titles h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  header .headerright { min-width: 0; }
  header .status { min-width: 0; flex: 0 1 auto; }
  header .status #status-txt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  header .quem { display: none; }

  /* ---------- abas: uma linha, rolável, grudada no topo ---------- */
  .shell > .tabs {
    position: sticky; top: var(--ml-head, 60px); z-index: 30;
    display: flex; flex-wrap: nowrap; gap: 0; width: auto;
    overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none;
    padding: 0 8px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0;
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px);
  }
  .shell > .tabs::-webkit-scrollbar { display: none; }
  .shell > .tabs .tab {
    flex: 1 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 48px; padding: 0 16px; border-radius: 0; white-space: nowrap;
    font-size: 14px; font-weight: 700; color: var(--muted); background: transparent; box-shadow: none;
  }
  .shell > .tabs .tab[hidden] { display: none !important; }
  .shell > .tabs .tab.active { color: var(--brand-ink); background: transparent; box-shadow: inset 0 -3px 0 var(--brand); }
  .shell > .tabs .tab-n { margin: 0; line-height: 20px; min-width: 22px; }
  /* sombras laterais indicando que há mais abas */
  .shell > .tabs.ml-mais-dir { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 32px), transparent); }
  .shell > .tabs.ml-mais-esq { -webkit-mask-image: linear-gradient(90deg, transparent, #000 32px); mask-image: linear-gradient(90deg, transparent, #000 32px); }
  .shell > .tabs.ml-mais-esq.ml-mais-dir { -webkit-mask-image: linear-gradient(90deg, transparent, #000 32px, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(90deg, transparent, #000 32px, #000 calc(100% - 32px), transparent); }

  /* ---------- chips de procedimento ---------- */
  #chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: 8px; }
  #chips::-webkit-scrollbar { display: none; }
  #chips .chip { flex: none; height: 40px; padding: 0 14px 0 12px; font-size: 13px; }

  /* ---------- busca + botão Filtros ---------- */
  #filtros { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; margin-bottom: 16px; }
  #filtros .search-wrap { grid-column: 1; min-width: 0; }
  #filtros input, #filtros select, #filtros .ghost { height: 44px; font-size: 16px; width: 100%; min-width: 0; border-radius: 12px; }
  #filtros > select, #filtros > #limpar { display: none; grid-column: 1 / -1; }
  #filtros.ml-fx-aberto > select:not([hidden]), #filtros.ml-fx-aberto > #limpar { display: block; }
  #filtros > #limpar { justify-self: stretch; }
  .ml-fx {
    display: inline-flex; align-items: center; gap: 8px; grid-column: 2;
    height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line-strong);
    background: var(--surface); color: var(--ink-soft); font-weight: 700; font-size: 14px; white-space: nowrap;
  }
  .ml-fx svg { width: 18px; height: 18px; flex: none; }
  .ml-fx[aria-expanded="true"], .ml-fx.ml-fx-on { border-color: var(--brand); color: var(--brand-ink); background: var(--brand-soft); }
  .ml-fx-n { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--brand); color: #fff; font-size: 12px; line-height: 20px; text-align: center; }
  [data-theme="dark"] .ml-fx-n { color: #2a0b19; }
}

/* =====================================================================
   TABLET (701 a 1100 px)
   ===================================================================== */
@media (min-width: 701px) and (max-width: 1100px) {
  header { padding: 12px 24px; gap: 16px; }
  .shell { max-width: none; padding: 16px 24px 48px; }
  .shell > .tabs { margin: -16px -24px 24px; padding: 0 16px; }
  #chips { margin: 0 -24px 16px; padding: 2px 24px 4px; }
  /* filtros abertos: três por linha */
  #filtros { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px 12px; }
  #filtros .search-wrap { grid-column: 1 / 6; }
  #filtros .ml-fx { grid-column: 6; justify-content: center; }
  #filtros > select, #filtros > #limpar { grid-column: span 2; }
}
/* tablet em pé: cabeçalho mais enxuto */
@media (min-width: 701px) and (max-width: 980px) {
  header .brand { flex: 0 0 auto; }
  header .headerright { flex: 1 1 auto; justify-content: flex-end; }
  header .status { display: flex; max-width: none; }
  header .status #status-txt { min-width: 0; }
  header .aovivo, header .icon-btn, header .sair { flex: none; }
  header .titles h1 { font-size: 18px; }
  header .logo { width: 40px; height: 40px; }
  header .icon-btn, header .sair { height: 40px; }
  header .icon-btn { width: 40px; }
}
/* tablet deitado (981 a 1100): ainda tabela; cabeçalho numa linha só */
@media (min-width: 981px) and (max-width: 1100px) {
  header .brand { flex: 0 0 auto; }
  header .titles .sub { display: none; }
  header .logo-saude { margin: 0 0 0 4px; padding-left: 16px; }
  header .logo-saude img { height: 28px; }
  header .headerright { flex: 1 1 auto; justify-content: flex-end; }
  header .status #status-txt { min-width: 0; }
  header .aovivo, header .icon-btn, header .sair { flex: none; }
}

/* ---------- barra de resultados e cartões (tablet) ---------- */
@media (min-width: 701px) and (max-width: 1100px) {
  #view-pacientes .resultbar {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "cont pager" "novo excel";
    align-items: center; gap: 12px 16px; margin-bottom: 16px; padding: 0; font-size: 14px;
  }
  #view-pacientes #contador { grid-area: cont; }
  #view-pacientes .resultbar > .pager { grid-area: pager; }
  #view-pacientes #btn-cadastrar { grid-area: novo; justify-self: start; width: auto; height: 44px; margin: 0; padding: 0 20px; border-radius: 12px; font-size: 14px; }
  #view-pacientes #excel { grid-area: excel; width: auto; justify-self: end; flex-wrap: nowrap; }
  #view-pacientes #excel .btn-xls, #view-pacientes #excel .xls-sel { flex: none; height: 44px; border-radius: 12px; }
  #view-pacientes #excel .xls-sel { width: 200px; }
  #view-pacientes .resultbar .pager button { height: 40px; padding: 0 14px; border-radius: 10px; font-size: 13px; }

  #view-pacientes .tablewrap tbody { gap: 16px; }
  #view-pacientes .tablewrap tbody tr { margin-bottom: 0; }
  #view-pacientes .pager-baixo { margin-top: 24px; gap: 8px; }
  #view-pacientes .pager-baixo button { height: 44px; padding: 0 20px; border-radius: 12px; font-size: 14px; }
}

/* ---------- cartões de paciente (celular e tablet em pé) ---------- */
@media (max-width: 980px) {
  #view-pacientes .tablewrap tbody tr {
    gap: 8px; padding: 16px; margin-bottom: 12px; border-radius: 16px;
    box-shadow: 0 1px 2px rgba(60,20,36,.06); align-items: center;
  }
  #view-pacientes .tablewrap td.c-prio .prio { padding: 4px 10px; font-size: 12px; }
  #view-pacientes .tablewrap td.c-proc { flex: 1 1 0; min-width: 0; display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; }
  #view-pacientes .tablewrap td.c-proc .proc { font-size: 12px; padding: 3px 8px; }
  #view-pacientes .tablewrap td.c-proc .sis { font-size: 10.5px; }
  #view-pacientes .tablewrap td.c-pac { margin-top: 4px; }
  #view-pacientes .tablewrap td.c-pac .nome { font-size: 16px; line-height: 1.3; }
  #view-pacientes .tablewrap td.c-pac .cns { font-size: 12px; margin-top: 2px; }
  #view-pacientes .tablewrap td.c-tel .tel-link { min-height: 44px; padding: 0 14px; border-radius: 12px; font-size: 15px; }
  #view-pacientes .tablewrap td.c-tel .mini { margin-top: 4px; font-size: 12px; }
  #view-pacientes .tablewrap td.c-cont .desf { font-size: 12px; }
  #view-pacientes .tablewrap td.c-cont .mini { font-size: 12px; margin-top: 2px; }
  /* rodapé do cartão: pedido e responsável em texto pequeno, separado por uma linha */
  #view-pacientes .tablewrap td.c-sol { order: 6; flex: 1 1 100%; margin-top: 4px; padding-top: 12px !important; border-top: 1px solid var(--line) !important; font-size: 12px; white-space: normal; }
  #view-pacientes .tablewrap td.c-sol div { display: inline; }
  #view-pacientes .tablewrap td.c-sol div::before { content: " · "; }
  #view-pacientes .tablewrap td.c-sit { order: 7; flex: 1 1 0; min-width: 0; font-size: 12px; }
  #view-pacientes .tablewrap td.c-resp { order: 8; font-size: 12px; }
  #view-pacientes .tablewrap td.c-sit:empty, #view-pacientes .tablewrap td.c-resp:empty { display: none; }
  #view-pacientes .tablewrap td.c-acao { margin-top: 4px; }
  #view-pacientes .tablewrap td.c-acao .reg { height: 44px; border-radius: 12px; font-size: 14px; font-weight: 800; }
}

/* =====================================================================
   CELULAR (até 700 px)
   ===================================================================== */
@media (max-width: 700px) {
  /* ---------- cabeçalho: marca + "ao vivo" + menu ---------- */
  header { padding: 8px 16px; gap: 12px; min-height: 60px; }
  header .brand { gap: 12px; }
  header .logo { width: 36px; height: 36px; border-radius: 10px; }
  header .logo svg { width: 20px; height: 20px; }
  header .titles h1 { font-size: 18px; letter-spacing: -.2px; }
  header .titles .sub { display: none; }
  header > .aovivo { flex: none; width: 32px; height: 32px; padding: 0; justify-content: center; border-radius: 999px; }
  header > .aovivo span { display: none; }
  header > .aovivo i { width: 10px; height: 10px; }
  .ml-menu {
    display: grid; place-items: center; flex: none; width: 44px; height: 44px; margin-right: -4px;
    border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft);
  }
  .ml-menu svg { width: 20px; height: 20px; }
  header.ml-aberto .ml-menu { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-ink); }

  /* o resto do cabeçalho vira um menu suspenso */
  header .headerright { display: none; }
  header.ml-aberto .headerright {
    display: flex; flex-direction: column; align-items: stretch; gap: 4px;
    position: absolute; top: calc(100% + 8px); right: 12px; width: min(300px, calc(100vw - 24px));
    padding: 8px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line);
    box-shadow: 0 24px 48px -16px rgba(40,10,24,.35);
  }
  header.ml-aberto .headerright > * { display: flex; }
  header.ml-aberto .headerright > [hidden] { display: none !important; }
  header.ml-aberto .headerright .quem { order: -2; display: block; padding: 8px 12px 4px; font-size: 14px; font-weight: 800; color: var(--ink); white-space: normal; }
  header.ml-aberto .headerright .status { order: -1; display: flex; align-items: flex-start; gap: 8px; margin: 0 0 4px; padding: 8px 12px 12px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; font-size: 12px; }
  header.ml-aberto .headerright .status .dot { margin-top: 5px; flex: none; }
  header.ml-aberto .headerright .status #status-txt { white-space: normal; }
  header.ml-aberto .headerright .icon-btn,
  header.ml-aberto .headerright .sair {
    width: 100%; height: 48px; padding: 0 12px; display: flex; align-items: center; justify-content: flex-start; gap: 12px;
    border: 0; border-radius: 10px; background: transparent; color: var(--ink); font-size: 14px; font-weight: 700; text-decoration: none;
  }
  header.ml-aberto .headerright .icon-btn:active, header.ml-aberto .headerright .sair:active { background: var(--surface-2); }
  header.ml-aberto .headerright .icon-btn svg, header.ml-aberto .headerright .sair svg { width: 20px; height: 20px; color: var(--muted); }
  header.ml-aberto .headerright .sair span { display: inline; }
  header.ml-aberto #recarregar::after { content: "Ler a planilha agora"; }
  header.ml-aberto #tema::after { content: "Tema escuro"; }
  [data-theme="dark"] header.ml-aberto #tema::after { content: "Tema claro"; }
  header.ml-aberto .headerright a.sair span { font-size: 0; }
  header.ml-aberto .headerright a.sair span::before { content: "Trocar a minha senha"; font-size: 14px; }
  header.ml-aberto #sair { margin-top: 4px; border-top: 1px solid var(--line); border-radius: 0 0 10px 10px; color: var(--bad); }
  header.ml-aberto #sair svg { color: var(--bad); }

  /* ---------- página ---------- */
  .shell { max-width: none; padding: 16px 16px 40px; }
  .shell > .tabs { margin: -16px -16px 16px; padding: 0 4px; }
  .shell > .tabs .tab { flex: none; padding: 0 14px; }
  #chips { margin: 0 -16px 12px; padding: 2px 16px 4px; }
  #filtros { gap: 8px; margin-bottom: 12px; }
  #filtros.ml-fx-aberto { padding-bottom: 4px; }

  /* ---------- barra de resultados: contagem + paginação compacta ---------- */
  #view-pacientes .resultbar { display: flex; flex-wrap: nowrap; align-items: center; gap: 8px; margin-bottom: 12px; padding: 0; font-size: 13px; }
  #view-pacientes #contador { flex: 1 1 auto; min-width: 0; line-height: 1.35; }
  #view-pacientes .resultbar > .pager { flex: none; gap: 4px; }
  #view-pacientes .resultbar > .pager #paginfo { min-width: 56px; text-align: center; font-size: 13px; font-weight: 700; color: var(--ink-soft); white-space: nowrap; }
  #view-pacientes .resultbar > .pager button { width: 40px; height: 40px; padding: 0; border-radius: 10px; font-size: 0; display: grid; place-items: center; }
  #view-pacientes .resultbar > .pager button::before { font-size: 22px; line-height: 1; font-weight: 600; }
  #view-pacientes #prev::before { content: "‹"; }
  #view-pacientes #next::before { content: "›"; }

  /* Cadastrar paciente: botão flutuante */
  #view-pacientes #btn-cadastrar {
    position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 35;
    width: auto; height: 52px; margin: 0; padding: 0 20px 0 16px; gap: 8px; border-radius: 16px; font-size: 14px;
    box-shadow: 0 12px 28px -10px rgba(122,22,69,.65), 0 2px 6px rgba(60,20,36,.18);
  }
  #view-pacientes #btn-cadastrar svg { width: 20px; height: 20px; }
  #view-pacientes:has(#btn-cadastrar:not([hidden])) { padding-bottom: 72px; }

  /* cartões: uma coluna */
  #view-pacientes .tablewrap tbody tr { margin-bottom: 12px; }

  /* paginação e Excel no fim da lista */
  #view-pacientes .pager-baixo { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; margin-top: 16px; }
  #view-pacientes .pager-baixo[hidden] { display: none; }
  #view-pacientes .pager-baixo button { height: 44px; padding: 0 12px; border-radius: 12px; font-size: 14px; }
  #view-pacientes .pager-baixo span { font-size: 13px; font-weight: 700; color: var(--muted); white-space: nowrap; }
  .ml-rodape { display: block; margin-top: 24px; }
  .ml-rodape:empty, .ml-rodape:has(> #excel[hidden]) { display: none; }
  .ml-rodape #excel { display: flex; width: 100%; gap: 8px; flex-wrap: nowrap; }
  .ml-rodape #excel .btn-xls { flex: 1 1 0; justify-content: center; height: 44px; border-radius: 12px; font-size: 14px; }
  .ml-rodape #excel .xls-sel { flex: 1 1 0; height: 44px; border-radius: 12px; font-size: 16px; min-width: 0; }
}

/* =====================================================================
   FICHA DA PACIENTE E CADASTRO (celular e tablet em pé)
   ===================================================================== */
@media (max-width: 980px) {
  #overlay .m-head, #cad .m-head { padding: 16px 16px 12px; gap: 12px; align-items: flex-start; }
  #overlay .m-head h2, #cad .m-head h2 { margin: 8px 0 4px; font-size: 20px; line-height: 1.25; }
  #overlay .m-head .m-sub, #cad .m-head .m-sub { font-size: 12px; line-height: 1.45; }
  #overlay .m-tags .prio, #overlay .m-tags .proc { font-size: 12px; }
  #overlay .m-x, #cad .m-x { width: 44px; height: 44px; border-radius: 12px; font-size: 22px; }
  #overlay .m-body, #cad .m-body { padding: 16px 16px 0; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }

  /* telefones e dados */
  #overlay .m-tels { gap: 8px; margin-bottom: 12px; }
  #overlay .m-tels a { min-height: 48px; border-radius: 12px; font-size: 16px; }
  #overlay .m-trava { margin-bottom: 12px; font-size: 14px; }
  #overlay .m-trava .ghost { height: 44px; }
  #overlay .m-det { margin-bottom: 16px; }
  #overlay .m-det summary { min-height: 44px; padding: 0 12px; border-radius: 12px; font-size: 12px; list-style: none; }
  #overlay .m-det summary::-webkit-details-marker { display: none; }
  #overlay .m-det summary::after { content: ""; width: 8px; height: 8px; margin: -4px 4px 0 auto; border: solid var(--muted); border-width: 0 2px 2px 0; transform: rotate(45deg); transition: transform .15s; }
  #overlay .m-det[open] summary::after { margin-top: 4px; transform: rotate(-135deg); }
  #overlay .m-dados { gap: 12px 16px; padding: 12px; }

  /* "Você assumiu": compacto, botão do lado */
  #overlay .m-assumir { flex-wrap: nowrap; align-items: center; gap: 12px; margin: 0 0 16px; padding: 12px; border-radius: 12px; }
  #overlay .m-assumir > div { flex: 1 1 0; min-width: 0; font-size: 14px; gap: 2px; line-height: 1.35; }
  #overlay .m-assumir span { font-size: 12px; }
  #overlay .m-assumir .ghost, #overlay .m-assumir .primario { flex: none; width: auto; height: 40px; padding: 0 16px; border-radius: 10px; font-size: 14px; background: var(--surface); }
  #overlay .m-assumir.outra { flex-wrap: wrap; }
  #overlay .m-assumir.outra .ghost { width: 100%; height: 44px; }

  /* registro do contato */
  #overlay .m-form h3 { margin: 0 0 12px; font-size: 16px; }
  #overlay .desf-opts { gap: 8px; margin-bottom: 16px; }
  #overlay .desf-opts button { min-height: 48px; padding: 8px 12px; border-radius: 12px; font-size: 14px; line-height: 1.25; }
  #overlay #m-turno button { min-width: 0; align-items: center; justify-content: center; }
  #overlay .m-reg { margin-bottom: 16px; }
  #overlay .m-reg-t { margin-bottom: 8px; }
  #overlay .m-form label, #cad .m-form label { margin-bottom: 16px; font-size: 12px; }
  #overlay .m-form input, #overlay .m-form textarea, #overlay .m-form select,
  #cad .m-form input, #cad .m-form select { margin-top: 8px; font-size: 16px; border-radius: 12px; }
  #overlay .m-form input:not([type=file]), #overlay .m-form select,
  #cad .m-form input, #cad .m-form select { height: 48px; padding: 0 12px; }
  #overlay .m-form input[type=date], #cad .m-form input[type=date] { width: 100%; }
  #overlay .m-form textarea { min-height: 96px; padding: 12px; line-height: 1.45; }
  #overlay .m-arq { margin-bottom: 16px; }
  #overlay .m-arq-btn span { height: 44px; padding: 0 16px; border-radius: 12px; font-size: 14px; }
  #overlay .m-arq-lista li { min-height: 44px; }
  #overlay .m-arq-tira { width: 40px; height: 40px; }
  #overlay .m-ult, #overlay .m-hist summary { font-size: 12px; }
  #overlay .m-hist summary { min-height: 44px; display: flex; align-items: center; }
  #overlay .m-hist li { font-size: 14px; padding: 8px 12px; }

  /* rodapé fixo da ficha e do cadastro */
  #overlay .m-acoes, #cad .m-acoes { margin: 0 -16px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); gap: 12px;
    box-shadow: 0 -8px 16px -12px rgba(60,20,36,.25); }
  #overlay .m-acoes button, #cad .m-acoes button { flex: 1 1 0; width: auto; height: 48px; border-radius: 12px; font-size: 15px; }

  /* cadastro */
  #cad .cad-grid { gap: 0 16px; }
  #cad .c-cadsus { gap: 8px; margin: 0 0 16px; }
  #cad .c-cadsus .ghost { width: 100%; height: 44px; border-radius: 12px; }
  #cad .m-erro { margin: 0 0 8px; }
}

/* tablet: ficha e cadastro como janela centralizada */
@media (min-width: 701px) and (max-width: 980px) {
  #overlay.overlay, #cad.overlay { padding: 24px; align-items: center; }
  #overlay .modal, #cad .modal { width: min(720px, 100%); height: auto; max-height: calc(100dvh - 48px); border-radius: 20px; border: 1px solid var(--line); }
  #overlay .m-head, #cad .m-head { padding: 24px 24px 16px; }
  #overlay .m-body, #cad .m-body { padding: 16px 24px 0; }
  #overlay .m-acoes, #cad .m-acoes { margin: 0 -24px; padding: 16px 24px; }
  #overlay .m-acoes button, #cad .m-acoes button { flex: 0 0 auto; min-width: 160px; }
  #overlay .m-acoes { justify-content: flex-end; }
  #cad .m-acoes { justify-content: flex-end; }
  #overlay .desf-opts { grid-template-columns: repeat(3, 1fr); }
  #overlay .m-dados { grid-template-columns: repeat(3, 1fr); }
  #cad .cad-grid { grid-template-columns: 1fr 1fr; }
}

/* celular: o rodapé ocupa a largura toda */
@media (max-width: 700px) {
  #overlay .modal, #cad .modal { height: 100dvh; max-height: 100dvh; border-radius: 0; }
  #overlay .m-dados { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 380px) {
  #overlay .m-dados { grid-template-columns: 1fr; }
}

/* =====================================================================
   LOGIN E TROCA DE SENHA (login.html e trocar-senha.html)
   ===================================================================== */
@media (max-width: 860px) {
  .pagina .painel { padding: 20px 16px 24px; gap: 16px; }
  .pagina .painel .marca { font-size: 14px; }
  .pagina .painel .logo { width: 40px; height: 40px; }
  .pagina .painel-meio h2 { font-size: 20px; line-height: 1.25; margin-bottom: 12px; }
  .pagina .painel p { font-size: 14px; margin-bottom: 16px; }
  .pagina .procs { gap: 6px; }
  .pagina .procs li { font-size: 12px; padding: 4px 10px; }
  .pagina .lado-form { padding: 24px 16px 40px; }
  .pagina .cartao .logo-saude { margin-bottom: 24px; }
  .pagina .cartao .logo-saude img { max-width: 300px; }
  .pagina h1 { font-size: 28px; }
  .pagina .sub { margin: 8px 0 24px; font-size: 14px; }
  .pagina label { font-size: 14px; margin-bottom: 8px; }
  .pagina .campo { margin-bottom: 16px; }
  .pagina .campo input { height: 52px; font-size: 16px; }
  .pagina .erro:empty { min-height: 8px; margin: 0; }
  .pagina .entrar { height: 52px; margin-top: 8px; }
  .pagina .ajuda { margin-top: 24px; font-size: 13px; line-height: 1.5; }
  .pagina .tema { width: 44px; height: 44px; top: 16px; right: 16px; }
  .pagina .ajuda a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 8px; margin: 0 4px; }
}
@media (min-width: 701px) and (max-width: 860px) {
  .pagina .painel { padding: 32px 48px; }
  .pagina .painel-meio { max-width: 560px; }
  .pagina .painel-meio h2 { font-size: 26px; }
  .pagina .lado-form { place-items: center; padding: 48px 24px; }
  .pagina .tema { top: 24px; right: 24px; }
}
@media (min-width: 861px) and (max-width: 1100px) {
  .pagina { grid-template-columns: minmax(340px, 42%) 1fr; }
  .pagina .painel { padding: 40px 32px; }
  .pagina .campo input { font-size: 16px; }
}

/* telefone no computador: texto que copia ao clicar (não é link de ligação) */
@media (hover: hover) and (pointer: fine) {
  a[href^="tel:"] { cursor: copy; }
  .tel-link:hover { text-decoration: none; }
  a[href^="tel:"]::after { content: ''; }
}

/* celular: alvos de toque com pelo menos 44 px */
@media (max-width: 700px) {
  #chips .chip { height: 44px; }
  #view-pacientes .resultbar > .pager button { width: 44px; height: 44px; }
  #overlay .m-assumir .ghost, #overlay .m-assumir .primario { height: 44px; }
  #overlay .m-docs .reg { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
  #view-usuarios .grid .reg { min-height: 44px; }
}

/* =====================================================================
   MODO FICHA (/?embed=1&ficha=<id>): a ficha ocupa a moldura inteira, dentro das fichas lado a lado.
   Vale em qualquer largura (a moldura pode ser estreita como um celular), por isso fica no fim.
   ===================================================================== */
body.embed { background: var(--surface); overflow: hidden; }
body.embed > :not(#overlay):not(#doc-ov):not(.toast):not(.viz-tip):not(script) { display: none !important; }
body.embed #overlay.overlay { position: fixed; inset: 0; padding: 0; background: var(--surface); align-items: stretch; justify-content: stretch; }
body.embed #overlay.overlay[hidden] { display: none; }
body.embed #overlay .modal { width: 100%; max-width: none; height: 100%; max-height: none; border: 0; border-radius: 0; box-shadow: none; }
body.embed #m-irmas { display: none !important; }
