/* Portal Saúde Cajamar — estilos compartilhados
   Paleta:
   --primary   #203b8f (azul institucional, cabeçalho)
   --primary-dark #152a68 (hover / texto sobre claro)
   --accent    #1c9c76 (verde-saúde, ações principais)
   --accent-dark #157b5d
   --ink       #1b2340 (texto principal)
   --muted     #5b6480 (texto secundário)
   --line      #dde3f0 (bordas)
   --surface   #f4f6fb (fundo de cartões)F
   --bg        #ffffff (fundo da página)
*/

:root {
  --primary: #203b8f;
  --primary-dark: #152a68;
  --accent: #1c9c76;
  --accent-dark: #157b5d;
  --ink: #1b2340;
  --muted: #5b6480;
  --line: #dde3f0;
  --surface: #f4f6fb;
  --bg: #f2f4f7;
  --danger: #c0392b;
  --radius: 10px;
  --shadow: 0 2px 10px rgba(32, 59, 143, 0.08);
  --shadow-lg: 0 12px 32px rgba(21, 42, 104, 0.16);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

h1, h2, h3 { font-weight: 700; letter-spacing: -0.01em; margin: 0; }

:focus-visible {
  outline: 3px solid #7ea0ff;
  outline-offset: 2px;
}

/* ---------- Barra superior ---------- */

.topbar {
  background: var(--primary);
  height: 68px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

/* Em telas largas, o conteúdo não gruda mais nas bordas — fica centralizado
   com a MESMA largura e respiro lateral da área de conteúdo (.page), pra
   logo/menu ficarem alinhados verticalmente com o título e o resto da página. */
.topbar__inner {
  max-width: 1400px;
  height: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

.topbar__left {
  display: flex;
  align-items: center;
  gap: 28px;
}

.hamburger-btn {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  border: none;
  background: rgba(255,255,255,0.14);
  cursor: pointer;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
}

.hamburger-icon,
.hamburger-icon::before,
.hamburger-icon::after {
  display: block;
  width: 18px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  position: relative;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.hamburger-icon::before { content: ""; position: absolute; top: -6px; }
.hamburger-icon::after { content: ""; position: absolute; top: 6px; }

.hamburger-btn.is-open .hamburger-icon { background: transparent; }
.hamburger-btn.is-open .hamburger-icon::before { transform: translateY(6px) rotate(45deg); }
.hamburger-btn.is-open .hamburger-icon::after { transform: translateY(-6px) rotate(-45deg); }

.nav__mobile-foot { display: none; }

.brand {
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: 6px;
  padding: 4px 10px;
  height: 48px;
  flex-shrink: 0;
}

.brand img {
  height: 100%;
  width: auto;
  max-width: none;
  display: block;
  object-fit: contain;
  flex-shrink: 0;
}

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav__item {
  position: relative;
}

.nav__link {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #ffffff;
  font-weight: 600;
  font-size: 14.5px;
  letter-spacing: 0.02em;
  padding: 10px 14px;
  border-radius: 6px;
  cursor: pointer;
  background: transparent;
  border: none;
  font-family: inherit;
}

.nav__link:hover,
.nav__link.is-open {
  background: rgba(255,255,255,0.14);
}

.nav__caret {
  width: 9px;
  height: 9px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  margin-top: -3px;
  transition: transform 0.15s ease;
}

.nav__link.is-open .nav__caret { transform: rotate(225deg); margin-top: 3px; }

.submenu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 240px;
  padding: 8px;
  display: none;
  border: 1px solid var(--line);
}

.submenu.is-open { display: block; }

.submenu__link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
}

.submenu__link:hover { background: var(--surface); color: var(--primary); }

.submenu__link .cross {
  color: var(--accent);
  flex-shrink: 0;
}

.topbar__right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-size: 14px;
  padding: 6px 10px;
}

.user-chip__avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-weight: 700;
  font-size: 14px;
  border-radius: 8px;
  padding: 10px 18px;
  border: none;
  cursor: pointer;
  transition: transform 0.05s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn:active { transform: translateY(1px); }

.btn--accent { background: var(--accent); color: #fff; }
.btn--accent:hover { background: var(--accent-dark); }

.btn--ghost-light {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.35);
}
.btn--ghost-light:hover { background: rgba(255,255,255,0.22); }

.btn--outline {
  background: #fff;
  color: var(--primary);
  border: 1.5px solid var(--line);
}
.btn--outline:hover { border-color: var(--primary); }

.btn--danger { background: #fff; color: var(--danger); border: 1.5px solid #f0c4bd; }
.btn--danger:hover { background: #fdece9; }

.btn--sm { padding: 7px 12px; font-size: 13px; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }

/* ---------- Layout de página ---------- */

.page {
  max-width: 1400px;
  margin: 30px auto;
  padding: 40px 24px 80px;
}

.page__header { margin-bottom: 28px; }

.eyebrow {
  color: var(--accent-dark);
  font-weight: 700;
  font-size: 12.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.page__title { font-size: 28px; color: var(--primary-dark); }
.page__subtitle { color: var(--muted); margin-top: 8px; font-size: 15px; max-width: 1400px; }

/* Cartões de acesso rápido (home) */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: box-shadow 0.15s ease, transform 0.1s ease, border-color 0.15s ease;
}

a.card:hover, .card:hover { box-shadow: var(--shadow); border-color: #c7d2ec; transform: translateY(-2px); }

.card__icon {
  width: 40px;
  height: 40px;
  border-radius: 9px;
  background: #e6ecfa;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
}

.card__title { font-weight: 700; font-size: 15.5px; color: var(--ink); }
.card__desc { color: var(--muted); font-size: 13.5px; line-height: 1.4; }

/* Lista de documentos/manuais */

.updates-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 720px;
}

.update-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px 22px;
  box-shadow: var(--shadow);
  max-width: 1400px;
}

.update-card__head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.update-card__date {
  color: var(--muted);
  font-size: 13px;
}

.update-card__title {
  font-size: 17px;
  color: var(--primary-dark);
  margin-bottom: 6px;
}

.update-card__body {
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.55;
  white-space: pre-line;
}

.update-card__link {
  display: inline-block;
  margin-top: 10px;
  color: var(--primary);
  font-weight: 600;
  font-size: 13.5px;
  text-decoration: none;
}

.update-card__link:hover { text-decoration: underline; }

.doc-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}

.doc-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.doc-row:hover { border-color: #c7d2ec; box-shadow: var(--shadow); }

.doc-row .cross {
  color: var(--accent);
  flex-shrink: 0;
}

.doc-row__title { font-weight: 600; font-size: 15px; flex: 1; }
.doc-row__desc { color: var(--muted); font-size: 13px; }

.report-back-link { display: inline-block; margin-bottom: 14px; color: var(--primary); font-weight: 600; font-size: 14px; text-decoration: none; }
.report-back-link:hover { text-decoration: underline; }
.report-frame-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
  box-shadow: var(--shadow);
}
.report-frame { width: 100%; height: 75vh; min-height: 480px; border: 0; display: block; }

.empty-state {
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  padding: 36px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  margin-top: 20px;
}

/* ---------- Login ---------- */

.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

/* Fundo interativo: rede wireframe (canvas) que reage ao mouse, com pontos
   e linhas em azul-claro sobre fundo branco. Puramente decorativo. */
.login-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.login-bg canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.login-layout {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1080px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 64px;
  padding: 0 24px;
}

.login-hero {
  flex: 1;
  min-width: 0;
  max-width: 520px;
}

.login-hero__title {
  font-size: 40px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--primary-dark);
  margin-bottom: 16px;
}

.login-hero__subtitle {
  font-size: 17px;
  line-height: 1.55;
  color: var(--muted);
  max-width: 46ch;
}

.login-card {
  width: 100%;
  max-width: 380px;
  flex-shrink: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  padding: 32px 30px 28px;
  position: relative;
  z-index: 1;
}

@media (max-width: 860px) {
  .login-layout {
    flex-direction: column;
    text-align: center;
    gap: 32px;
  }
  .login-hero {
    max-width: 100%;
  }
  .login-hero__title { font-size: 28px; }
  .login-hero__subtitle { margin: 0 auto; }
}


.login-card .brand {
  margin: 0 auto 22px;
  display: flex;
  justify-content: center;
  padding: 8px 14px;
}

.login-card .brand img { height: 56px; width: auto; max-width: none; object-fit: contain; flex-shrink: 0; }

.login-title { text-align: center; font-size: 19px; color: var(--primary-dark); margin-bottom: 4px; }
.login-subtitle { text-align: center; color: var(--muted); font-size: 13.5px; margin-bottom: 22px; }

.field { margin-bottom: 16px; }

.field--turnstile { justify-content: center; }

.field label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 6px;
}

.field input, .field select {
  width: 100%;
  padding: 11px 13px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  font-size: 14.5px;
  font-family: inherit;
  color: var(--ink);
  background: #fff;
}

.field input:focus, .field select:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(32,59,143,0.14);
}

.form-msg {
  font-size: 13.5px;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 14px;
  display: none;
}

.form-msg.is-error { display: block; background: #fdece9; color: var(--danger); }
.form-msg.is-ok { display: block; background: #e7f7f1; color: var(--accent-dark); }

.login-card .btn { width: 100%; padding: 12px; font-size: 15px; }

.login-foot {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  margin-top: 18px;
}

.login-foot a { color: var(--primary); text-decoration: none; font-weight: 600; }
.login-foot a:hover { text-decoration: underline; }

.login-card--wide { max-width: 460px; }

.admin-tab__count {
  display: inline-block;
  margin-left: 6px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
  padding: 1px 7px;
}

/* ---------- Admin ---------- */

.admin-shell { display: flex; gap: 28px; align-items: flex-start; }

.admin-tabs {
  width: 220px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 92px;
}

.admin-tab {
  text-align: left;
  padding: 11px 14px;
  border-radius: 8px;
  border: none;
  background: transparent;
  font-family: inherit;
  font-weight: 600;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
}

.admin-tab:hover { background: var(--surface); color: var(--ink); }
.admin-tab.is-active { background: var(--primary); color: #fff; }

.admin-panel { flex: 1; min-width: 0; }

.panel-section {
  display: block;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-sizing: border-box;
  width: 100%;
}

.panel-section.is-active { display: block; }
.panel-section[hidden] { display: none !important; }

.panel-section__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.panel-section__title { font-size: 17px; color: var(--primary-dark); }
.panel-section__desc { color: var(--muted); font-size: 13.5px; margin-top: 4px; margin-bottom: 18px; }

/* Wrapper de rolagem horizontal para tabelas largas — vale em qualquer
   largura de tela, não só no mobile, para a tabela nunca vazar do card. */
.table-wrap, #usersTableWrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table th {
  text-align: left;
  color: var(--muted);
  font-weight: 700;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 10px 12px;
  border-bottom: 1.5px solid var(--line);
}

.data-table td {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.data-table td.muted-url { color: var(--muted); max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* .actions-cell é o <td> de verdade (mantém display:table-cell / vertical-align
   herdados de .data-table td). .row-actions é o <div> DENTRO dele que cuida do
   flex — antes o flex estava direto no <td>, o que tirava a célula do fluxo
   normal de tabela e fazia sua altura/alinhamento vertical não bater com as
   outras células da mesma linha. */
.row-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-start;
  align-items: center;
  flex-wrap: nowrap;
}
.row-actions .btn { white-space: nowrap; flex-shrink: 0; }

/* Tabela de usuários tem uma coluna de ações mais larga (3 botões em vez de 2);
   isso evita que ela "puxe" as outras colunas de forma inconsistente entre linhas. */
#usersTableWrap table.data-table td.actions-cell:last-child,
#usersTableWrap table.data-table th:last-child {
  white-space: nowrap;
}
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
}

.badge--admin { background: #e6ecfa; color: var(--primary); }
.badge--user { background: var(--surface); color: var(--muted); }
.badge--inactive { background: #fdece9; color: var(--danger); }

.inline-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px dashed var(--line);
}

.inline-form .field { margin-bottom: 0; }
.inline-form .field--full { grid-column: 1 / -1; }
.inline-form__actions { grid-column: 1 / -1; display: flex; gap: 10px; margin-top: 4px; }

/* Modal simples */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(21,42,104,0.35);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}

.modal-backdrop.is-open { display: flex; }

.modal {
  background: #fff;
  border-radius: 12px;
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  box-shadow: var(--shadow-lg);
}

/* Usado pelo card de Configurações do profissional (várias seções). */
.modal--wide { max-width: 580px; }

/* Lista de checkboxes (funcionalidades, unidades, grupos de relatórios). */
.checkbox-list {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 12px;
}

.modal h3 { font-size: 16.5px; color: var(--primary-dark); margin-bottom: 4px; }
.modal p.muted { color: var(--muted); font-size: 13.5px; margin: 4px 0 18px; }
.modal__actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

.skeleton-loading { color: var(--muted); font-size: 13.5px; padding: 20px 0; }

@media (max-width: 760px) {
  .admin-shell { flex-direction: column; }
  .admin-tabs { flex-direction: row; overflow-x: auto; width: 100%; position: static; }
  .inline-form { grid-template-columns: 1fr; }
  .topbar__left { gap: 10px; }
  .topbar__inner { padding: 0 16px; }

  /* Menu hambúrguer */
  .hamburger-btn { display: flex; }

  .user-chip { display: none; }
  .topbar__right .btn--ghost-light { display: none; }

  .nav {
    display: none;
    position: absolute;
    top: 68px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    background: var(--primary);
    padding: 10px 12px 14px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.18);
    max-height: calc(100vh - 68px);
    overflow-y: auto;
  }

  .nav.is-mobile-open { display: flex; }

  .nav__item { width: 100%; }
  .nav__link { width: 100%; justify-content: space-between; }

  .submenu {
    position: static;
    display: none;
    box-shadow: none;
    border: none;
    background: transparent;
    padding: 2px 0 2px 14px;
    min-width: 0;
  }

  .submenu.is-open { display: block; }

  .submenu__link { color: #fff; }
  .submenu__link:hover { background: rgba(255,255,255,0.12); color: #fff; }

  .nav__mobile-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    padding-top: 12px;
    border-top: 1px solid rgba(255,255,255,0.18);
  }

  .nav__mobile-foot .user-chip { display: flex; color: #fff; }

  /* Tabela com largura mínima no mobile para rolar em vez de espremer colunas */
  table.data-table { min-width: 560px; }

  /* Botões de ação com mais espaço de toque */
  .row-actions { flex-wrap: wrap; justify-content: flex-start; gap: 8px; }
  .row-actions .btn { flex: 0 0 auto; }

  /* Espaçamento de página mais enxuto */
  .page { padding: 24px 16px 48px; }
}

/* ======================================================================
   eMulti — chrome enxuto (topo + menu lateral recolhível)
   ====================================================================== */

:root {
  --app-topbar-h: 66px;
  --side-w: 70px;
  --side-w-open: 238px;
  --side-bg: #ffffff;
  --side-ink: #173e72;
  --side-hover: #eef5fb;
}

body { min-height: 100vh; }

.app-topbar {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--app-topbar-h);
  z-index: 220;
  background: var(--primary);
}

.app-topbar__inner {
  width: 100%;
  max-width: none;
  padding: 0 26px 0 20px;
}

.app-brand {
  height: 54px;
  padding: 0;
  background: transparent;
  border-radius: 0;
  gap: 10px;
}

.app-brand img {
  height: 46px;
  filter: brightness(0) invert(1);
}

.app-brand__text {
  color: #fff;
  display:flex;
  align-items:center;
  gap:10px;
  font-size:17px;
  letter-spacing:-0.02em;
  white-space:nowrap;
}
.app-brand__text strong { font-size:22px; font-weight:800; }
.app-brand__text > span:last-child { color:#fff; font-weight:600; }
.app-brand__divider { width:1px; height:24px; background:rgba(255,255,255,.28); display:inline-block; }

.app-topbar__actions { display:flex; align-items:center; gap:9px; margin-left:auto; }

.account-wrap { position: relative; }

.account-button {
  border: 0;
  background: transparent;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 7px 8px 7px 14px;
  border-radius: 7px;
  font-family: inherit;
  cursor: pointer;
  text-align: right;
}

.account-button:hover,
.account-button[aria-expanded="true"] { background: rgba(255,255,255,.10); }

.account-button__identity {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 180px;
  max-width: 340px;
}

.account-button__identity strong {
  font-size: 13px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-button__identity small {
  font-size: 11px;
  font-weight: 600;
  opacity: .94;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-button__chevron { font-size: 20px; line-height: 1; transform: translateY(-2px); }

.account-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 230px;
  padding: 7px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  z-index: 260;
}

.account-menu[hidden] { display: none; }

.account-menu a,
.account-menu button {
  width: 100%;
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 11px;
  border-radius: 7px;
  color: var(--ink);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}

.account-menu a:hover,
.account-menu button:hover { background: var(--surface); color: var(--primary); }

.account-menu svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
.account-menu__divider { height: 1px; background: var(--line); margin: 5px 3px; }

.side-nav {
  position: fixed;
  z-index: 210;
  left: 0;
  top: var(--app-topbar-h);
  bottom: 0;
  width: var(--side-w);
  background: var(--side-bg);
  border-right: 1px solid #dbe3ec;
  box-shadow: 2px 0 10px rgba(20,44,80,.045);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  transition: width .18s ease;
}

.side-nav:hover,
.side-nav:focus-within { width: var(--side-w-open); }

.side-nav__items { padding: 14px 9px; display: flex; flex-direction: column; gap: 6px; }
.side-nav__bottom { padding: 10px 9px 16px; border-top: 1px solid rgba(23,62,114,.12); }

.side-nav__item {
  min-height: 48px;
  width: 100%;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--side-ink);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 11px;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s ease, color .12s ease;
}

.side-nav__item:hover { background: var(--side-hover); }
.side-nav__item.is-active { background: #b9d9f1; color: #0f4f91; }
.side-nav__button { text-align: left; }

.side-nav__icon {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.side-nav__icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.side-nav__label {
  opacity: 0;
  transform: translateX(-5px);
  transition: opacity .12s ease .02s, transform .15s ease;
  font-size: 13.5px;
  font-weight: 700;
}

.side-nav:hover .side-nav__label,
.side-nav:focus-within .side-nav__label { opacity: 1; transform: translateX(0); }

.side-nav__badge {
  position: absolute;
  right: -3px;
  top: -2px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #c0392b;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  border: 2px solid var(--side-bg);
}
.side-nav__badge[hidden] { display: none; }

.page {
  max-width: none;
  margin: 0 0 0 var(--side-w);
  padding: calc(var(--app-topbar-h) + 34px) 38px 70px;
}

.page > * { max-width: 1380px; margin-left: auto; margin-right: auto; }

.bell-panel {
  position: fixed;
  z-index: 250;
  left: calc(var(--side-w) + 12px);
  top: calc(var(--app-topbar-h) + 156px);
  width: min(360px, calc(100vw - 100px));
  max-height: 440px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
}
.bell-panel[hidden] { display: none; }
.bell-panel__head { min-height: 48px; padding: 11px 14px; display:flex; justify-content:space-between; align-items:center; border-bottom:1px solid var(--line); }
.bell-panel__head button { border:0; background:transparent; font-size:23px; line-height:1; color:var(--muted); cursor:pointer; }
.bell-panel__list { max-height: 385px; overflow-y:auto; padding: 7px; }
.bell-panel__list .empty-state { margin: 0; padding: 24px 12px; }
.bell-item { width:100%; border:0; background:#fff; padding:11px 12px; border-radius:8px; text-align:left; font-family:inherit; cursor:pointer; display:flex; flex-direction:column; gap:4px; }
.bell-item:hover { background:var(--surface); }
.bell-item span { font-size:13px; line-height:1.4; color:var(--ink); }
.bell-item small { font-size:11px; color:var(--muted); }

/* Cards de links úteis */
.useful-links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}

.useful-link-card {
  min-height: 132px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 1px 5px rgba(21,42,104,.04);
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 13px;
  align-items: start;
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
}

.useful-link-card:hover { transform: translateY(-2px); border-color:#b8c9e9; box-shadow:var(--shadow); }
.useful-link-card__icon { width:44px; height:44px; border-radius:10px; background:#e8f1fb; color:var(--primary); display:flex; align-items:center; justify-content:center; }
.useful-link-card__icon svg { width:23px; height:23px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.useful-link-card__title { font-weight:700; font-size:14px; color:var(--ink); margin-top:2px; }
.useful-link-card__desc { font-size:12.5px; color:var(--muted); line-height:1.45; margin-top:6px; }
.useful-links-section { margin-top: 26px; }
.useful-links-section__title { color:var(--primary-dark); font-size:17px; margin-bottom:12px; }

/* Administração */
.admin-summary-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(190px,1fr)); gap:12px; margin-bottom:22px; }
.admin-summary-card { border:1px solid var(--line); border-radius:10px; background:#fff; padding:15px; }
.admin-summary-card strong { display:block; color:var(--primary-dark); font-size:22px; margin-bottom:3px; }
.admin-summary-card span { color:var(--muted); font-size:12.5px; }
.admin-summary-card.is-warning { border-color:#e6c779; background:#fffaf0; }
.admin-summary-card.is-ok { border-color:#b8dfd2; background:#f4fbf8; }
.admin-actions-row { display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.icon-choice { display:flex; align-items:center; gap:8px; }
.icon-preview { width:32px; height:32px; border-radius:7px; background:#e8f1fb; color:var(--primary); display:flex; align-items:center; justify-content:center; }
.icon-preview svg { width:18px; height:18px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }

.notice-box { border:1px solid #d8e4f4; background:#f6f9fd; border-radius:10px; padding:13px 15px; color:#36516f; font-size:13px; line-height:1.5; margin:12px 0 18px; }
.notice-box.is-warning { border-color:#eccd84; background:#fff9ea; color:#735b21; }
.notice-box.is-error { border-color:#efc1b8; background:#fff4f2; color:#8b3528; }

@media (max-width: 760px) {
  :root { --app-topbar-h: 60px; --side-w: 58px; }
  .app-topbar__inner { padding: 0 12px; }
  .app-brand img {
    height: 40px;
    filter: brightness(0) invert(1);
  }
  .app-brand__text { display:none; }
  .app-topbar__actions { gap:6px; }
  .account-button { padding:6px; }
  .account-button__identity { min-width:0; max-width:210px; }
  .account-button__identity strong { font-size:11.5px; max-width:180px; }
  .account-button__identity small { font-size:10px; max-width:180px; }
  .side-nav, .side-nav:hover, .side-nav:focus-within { width:var(--side-w); }
  .side-nav__label { display:none; }
  .side-nav__items, .side-nav__bottom { padding-left:6px; padding-right:6px; }
  .side-nav__item { padding:8px 7px; }
  .page { margin-left:var(--side-w); padding:calc(var(--app-topbar-h) + 24px) 15px 48px; }
  .bell-panel { left:calc(var(--side-w) + 7px); top:calc(var(--app-topbar-h) + 130px); width:calc(100vw - var(--side-w) - 14px); }
}

/* ======================================================================
   eMulti — rodapé institucional
   ====================================================================== */
.app-footer {
  margin-left: var(--side-w);
  border-top: 1px solid var(--line);
  background: var(--bg);
  color: var(--muted);
}
.app-footer__inner {
  max-width: 1380px;
  min-height: 92px;
  margin: 0 auto;
  padding: 20px 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}
.app-footer__brand {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 12.5px;
  line-height: 1.35;
}
.app-footer__brand strong { color: var(--primary-dark); font-size: 13px; }
.app-footer__brand small { font-size: 11.5px; color: var(--muted); }
.app-footer__links {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  flex-wrap: wrap;
}
.app-footer__links a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 6px 4px;
  color: var(--primary-dark);
  font-size: 12.5px;
  font-weight: 600;
}
.app-footer__links a:hover { color: var(--primary); text-decoration: underline; text-underline-offset: 3px; }
.app-footer__links svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.app-footer__dot { color: var(--line); }

.legal-page { max-width: 980px !important; }
.legal-card { border:1px solid var(--line); border-radius:12px; background:var(--bg); padding:26px 30px; box-shadow:var(--shadow); }
.legal-card h2 { margin:26px 0 8px; color:var(--primary-dark); font-size:18px; }
.legal-card h2:first-child { margin-top:0; }
.legal-card p, .legal-card li { color:var(--ink); font-size:14px; line-height:1.7; }
.legal-card ul { padding-left:22px; }
.legal-meta { margin-top:22px; padding-top:18px; border-top:1px solid var(--line); color:var(--muted); font-size:12px; }
.support-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; margin-top:18px; }
.support-box { border:1px solid var(--line); border-radius:10px; padding:18px; background:var(--surface); }
.support-box h3 { font-size:15px; color:var(--primary-dark); margin-bottom:7px; }
.support-box p { margin:0; font-size:13px; color:var(--muted); line-height:1.6; }

@media (max-width: 760px) {
  .app-footer__inner { padding:18px 15px; align-items:flex-start; flex-direction:column; gap:12px; }
  .app-footer__links { justify-content:flex-start; gap:8px 12px; }
  .app-footer__dot { display:none; }
  .support-grid { grid-template-columns:1fr; }
  .legal-card { padding:20px 18px; }
}
@media (max-width: 760px) {
  .app-footer { margin-left: var(--side-w); }
}

.side-nav.is-pinned-open{width:var(--side-w-open)}.side-nav.is-pinned-open .side-nav__label{opacity:1;transform:translateX(0)}.side-nav__toggle{margin:10px 9px 0;width:42px;height:36px;border:0;border-radius:9px;background:transparent;color:var(--side-ink);cursor:pointer;display:flex;align-items:center;justify-content:center;font-size:20px}.side-nav__toggle:hover{background:var(--side-hover)}

/* v2.16.1 — restaura a paleta clara aprovada */
html:not([data-theme-resolved="dark"]):not([data-theme-resolved="contrast"]) body { background:#f2f4f7; }
html:not([data-theme-resolved="dark"]):not([data-theme-resolved="contrast"]) .side-nav { background:#fff; }
html:not([data-theme-resolved="dark"]):not([data-theme-resolved="contrast"]) :is(.panel-section,.card,.update-card,.account-card,.about-card,.adm-card,.reg-paciente-box,.sessao-card,.metric,.role-card) { background:#fff; }
html:not([data-theme-resolved="dark"]):not([data-theme-resolved="contrast"]) .side-nav__item:hover { background:#eef5fb; }
html:not([data-theme-resolved="dark"]):not([data-theme-resolved="contrast"]) .side-nav__item.is-active { background:#dcecf8; }

.chat-shell{display:grid;grid-template-columns:minmax(220px,300px) 1fr;gap:18px;min-height:62vh}.chat-sidebar,.chat-main{background:var(--surface,#fff);border:1px solid var(--line);border-radius:16px}.chat-sidebar{padding:14px;overflow:auto}.chat-main{display:flex;flex-direction:column;overflow:hidden}.chat-head{padding:16px 18px;border-bottom:1px solid var(--line);display:flex;justify-content:space-between;gap:12px;align-items:center}.chat-messages{padding:18px;display:flex;flex-direction:column;gap:10px;overflow:auto;min-height:420px;max-height:62vh}.chat-message{max-width:78%;padding:10px 12px;border-radius:14px;background:var(--soft,#f1f4f8);align-self:flex-start}.chat-message.is-own{align-self:flex-end;background:rgba(32,59,144,.12)}.chat-message__meta{font-size:11px;color:var(--muted);margin-bottom:4px}.chat-compose{display:flex;gap:10px;padding:14px;border-top:1px solid var(--line)}.chat-compose textarea{flex:1;min-height:52px;resize:vertical}.chat-room-btn{width:100%;text-align:left;padding:10px;border:0;border-radius:10px;background:transparent;cursor:pointer}.chat-room-btn:hover,.chat-room-btn.is-active{background:var(--soft,#f1f4f8)}.ticket-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(280px,1fr));gap:14px}.ticket-card,.future-card{border:1px solid var(--line);border-radius:14px;padding:16px;background:var(--surface,#fff)}@media(max-width:800px){.chat-shell{grid-template-columns:1fr}.chat-message{max-width:92%}}

/* Chat v2 — presença, não lidas e suporte */
.chat-presence-bar{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin:0 0 14px;padding:10px 14px;border:1px solid var(--border);border-radius:12px;background:var(--surface,#fff)}
.chat-online-list{display:flex;gap:7px;flex-wrap:wrap}.chat-online-chip{display:inline-flex;align-items:center;gap:6px;padding:5px 9px;border:1px solid var(--border);border-radius:999px;font-size:12px}.chat-online-chip i,.presence-dot{width:8px;height:8px;border-radius:50%;background:#9aa0a6;display:inline-block}.chat-online-chip i,.presence-dot.is-online{background:#22a06b;box-shadow:0 0 0 3px rgba(34,160,107,.12)}
.chat-message-row{display:flex;gap:9px;align-items:flex-end;margin:9px 0}.chat-message-row.is-own{flex-direction:row-reverse}.chat-avatar{width:32px;height:32px;flex:0 0 32px;border-radius:50%;display:grid;place-items:center;background:var(--surface-2,#eef2f7);font-size:11px;font-weight:700;border:1px solid var(--border)}.chat-message-row .chat-message{margin:0;max-width:min(78%,720px)}.chat-message__meta{display:flex;gap:7px;flex-wrap:wrap;align-items:center}.chat-message__meta span{opacity:.72}
.chat-sidebar__head{display:flex;flex-direction:column;gap:2px;margin-bottom:10px}.chat-room-title{display:flex;align-items:center;gap:7px}.chat-unread,.menu-unread-badge{display:inline-grid;place-items:center;min-width:19px;height:19px;padding:0 5px;border-radius:999px;background:#d93025;color:#fff;font-size:11px;font-style:normal}.chat-room-btn em{display:block;margin-top:5px;font-size:11px;font-style:normal;opacity:.7}.chat-head-actions{display:flex;gap:8px;flex-wrap:wrap}.chat-status-pill{display:inline-block;margin-left:8px;padding:3px 8px;border:1px solid var(--border);border-radius:999px;font-size:11px;font-weight:600}.account-menu .menu-unread-badge,.portal-account-menu .menu-unread-badge{margin-left:auto}


/* 2.25.1 — correções de visibilidade e identificação da versão */
.app-version-stamp{position:fixed;right:16px;bottom:12px;z-index:70;padding:4px 8px;border:1px solid var(--line);border-radius:999px;background:color-mix(in srgb,var(--surface) 92%,transparent);color:var(--muted);font-size:10px;font-weight:700;box-shadow:0 2px 8px rgba(0,0,0,.06);pointer-events:none;backdrop-filter:blur(6px)}
@media(max-width:720px){.app-version-stamp{right:8px;bottom:8px;font-size:9px}}
