/* OrgMédicos — estilos responsivos (mobile-first), compatíveis com Safari macOS / iOS 14+ */

:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f3f6f6;
  --text: #13201f;
  --muted: #5b6b6a;
  --border: #dbe4e3;
  --primary: #0f766e;
  --primary-strong: #0b5f58;
  --primary-soft: #e0f2ef;
  --on-primary: #ffffff;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --warn: #92400e;
  --warn-soft: #fef3c7;
  --ok: #166534;
  --ok-soft: #dcfce7;
  --info: #1e4fa8;
  --info-soft: #e3ecfd;
  --shadow: 0 1px 2px rgba(16, 32, 31, .06), 0 2px 8px rgba(16, 32, 31, .05);
  --radius: 12px;
  --sidebar: 248px;
  --sidebar-bg: #f4f7f9; /* branco gelo */
  --tabbar-h: 60px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}


*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3 { line-height: 1.2; margin: 0; }
h1 { font-size: 1.45rem; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; }
h3 { font-size: .95rem; }
p { margin: 0; }
a { color: var(--primary); text-decoration: none; }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }

svg.i, .i svg {
  width: 20px; height: 20px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

.muted { color: var(--muted); }
.small { font-size: .85rem; }
.grow { -webkit-box-flex: 1; flex: 1 1 auto; min-width: 0; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Layout ---------- */
.layout { min-height: 100vh; min-height: 100dvh; }

.topbar {
  position: -webkit-sticky; position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + var(--safe-top)) calc(16px + var(--safe-right)) 10px calc(16px + var(--safe-left));
  background: rgba(255, 255, 255, .92);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.05rem; color: var(--text); }
.brand img { width: 30px; height: 30px; border-radius: 8px; }
.logo { display: block; line-height: 0; }
.logo img { width: auto; height: auto; max-width: 100%; }
.logo-topbar img { height: 34px; }
.logo-sidebar { padding: 6px 8px 12px; }
.logo-sidebar img { width: 100%; max-width: 210px; }
.logo-login { text-align: center; margin: 0 auto 10px; }
.logo-login img { display: inline-block; width: 100%; max-width: 300px; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 12px; color: var(--primary);
  background: var(--primary-soft); border: 0;
}

.sidebar { display: none; }

.view {
  padding: 16px calc(16px + var(--safe-right)) calc(var(--tabbar-h) + var(--safe-bottom) + 24px) calc(16px + var(--safe-left));
  max-width: 1180px; margin: 0 auto; outline: none;
}

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: space-around;
  padding: 6px var(--safe-right) calc(6px + var(--safe-bottom)) var(--safe-left);
  background: rgba(255, 255, 255, .96);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
  border-top: 1px solid var(--border);
}
.tabbar a {
  -webkit-box-flex: 1; flex: 1 1 0; display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-height: 48px; justify-content: center;
  color: var(--muted); font-size: .7rem; font-weight: 600;
}
.tabbar a.ativo { color: var(--primary); }
.tabbar a span { font-weight: 800; text-shadow: -1px -1px 0 rgba(255, 255, 255, .95), 1px 1px 1px rgba(15, 23, 42, .25); }
.tabbar a svg { width: 24px; height: 24px; }

@media (min-width: 900px) {
  .layout { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); }
  .topbar, .tabbar { display: none; }
  .sidebar {
    display: flex; flex-direction: column; gap: 18px;
    position: -webkit-sticky; position: sticky; top: 0; height: 100vh; height: 100dvh;
    padding: 20px 14px; background: var(--sidebar-bg); border-right: 1px solid #e3e9ec;
  }
  .sidebar .brand { padding: 4px 8px 10px; }
  .nav { display: flex; flex-direction: column; gap: 2px; }
  .nav a {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
    color: var(--muted); font-weight: 600;
  }
  .nav a:hover { background: #e8eef1; color: var(--text); }
  /* nomes do menu em negrito com alto-relevo */
  .nav a { color: #334155; font-weight: 800; letter-spacing: .01em; }
  .nav a span { text-shadow: -1px -1px 0 rgba(255, 255, 255, .95), 1px 1px 1px rgba(15, 23, 42, .28); }
  .nav a svg { -webkit-filter: drop-shadow(1px 1px 0 rgba(15, 23, 42, .18)); filter: drop-shadow(1px 1px 0 rgba(15, 23, 42, .18)); }
  .nav a.ativo { color: var(--primary); }
  .sidebar .empresa-box { background: #fff; }
  .nav a.ativo { background: var(--primary-soft); color: var(--primary); }
  .sidebar-user { margin-top: auto; padding: 12px; border-top: 1px solid var(--border); font-size: .85rem; }
  .view { padding: 28px 32px 48px; }
}

/* ---------- Cabeçalho de página ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.page-head p { margin-top: 4px; }
.head-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.voltar { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 8px; font-weight: 600; font-size: .9rem; min-height: 32px; }

/* ---------- Cartões ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px;
}
.card + .card { margin-top: 14px; }
.card > h2 { margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
/* minmax(0, 1fr): sem isso, no celular a coluna cresce até o tamanho do maior texto (nomes longos)
   e os cartões passam da largura da tela */
.cols { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.cols > *, .dash-grid > *, .ficha-grid > *, .ia-colunas > *, .backup-grid > * { min-width: 0; }
.cols > .card + .card { margin-top: 0; }
@media (min-width: 760px) { .cols { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
@media (min-width: 760px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; } }
.stats > .card + .card { margin-top: 0; }
.stat { padding: 14px 16px; }
.stat .num { font-size: 1.8rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .rot { color: var(--muted); font-size: .82rem; font-weight: 600; }

.alerta { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; margin-bottom: 14px; font-size: .92rem; }
.alerta svg { margin-top: 1px; }
.alerta-warn { background: var(--warn-soft); color: var(--warn); }
.alerta-danger { background: var(--danger-soft); color: var(--danger); }
.alerta-info { background: var(--info-soft); color: var(--info); }
.alerta-ok { background: var(--ok-soft); color: var(--ok); }
.alerta ul { margin: 4px 0 0; padding-left: 18px; }

/* ---------- Botões ---------- */
.btn {
  -webkit-appearance: none; appearance: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 16px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; cursor: pointer; text-align: center;
  -webkit-user-select: none; user-select: none; touch-action: manipulation;
}
.btn:hover { background: var(--surface-2); }
.btn:active { -webkit-transform: scale(.98); transform: scale(.98); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-strong); border-color: var(--primary-strong); }
.btn-danger { color: var(--danger); border-color: var(--danger-soft); background: var(--danger-soft); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--primary); }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: .88rem; }
.btn-block { width: 100%; }
.btn svg { width: 18px; height: 18px; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.actions-sticky {
  position: -webkit-sticky; position: sticky; bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 8px);
  background: var(--surface); padding: 10px; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  z-index: 5;
}
@media (min-width: 900px) { .actions-sticky { bottom: 12px; } }
@media (max-width: 559px) { .actions .btn { -webkit-box-flex: 1; flex: 1 1 auto; } }

/* ---------- Formulários ---------- */
fieldset { border: 0; margin: 0 0 18px; padding: 0; min-width: 0; }
legend { font-weight: 700; font-size: .95rem; margin-bottom: 10px; padding: 0; }
.grid { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 560px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .span-2 { grid-column: span 2; } }
@media (min-width: 1100px) { .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .grid-3 .span-2 { grid-column: span 2; } .grid-3 .span-3 { grid-column: span 3; } }
@media (min-width: 560px) and (max-width: 1099px) { .grid-3 .span-3 { grid-column: span 2; } }

.campo { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.campo > span { font-size: .82rem; font-weight: 600; color: var(--muted); }
.campo > span .req { color: var(--danger); }
.campo .dica { font-size: .78rem; color: var(--muted); }
.campo .dica.erro { color: var(--danger); }

input, select, textarea {
  -webkit-appearance: none; appearance: none;
  width: 100%; min-height: 44px; padding: 10px 12px;
  /* 16px evita o zoom automático do Safari no iOS ao focar */
  font: inherit; font-size: 16px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  outline: none; margin: 0;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
input.invalido { border-color: var(--danger); }
textarea { min-height: 88px; resize: vertical; line-height: 1.4; }
select {
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235b6b6a' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 18px;
}
/* Safari iOS: campos de data/hora vazios encolhem sem isso */
input[type="date"], input[type="datetime-local"], input[type="time"] { display: block; min-height: 44px; line-height: 1.4; text-align: left; }
input::-webkit-date-and-time-value { text-align: left; min-height: 1.4em; }
input[type="search"]::-webkit-search-decoration { -webkit-appearance: none; }
input::-webkit-input-placeholder, textarea::-webkit-input-placeholder { color: var(--muted); opacity: .7; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .7; }

.busca { position: relative; margin-bottom: 14px; }
.busca svg { position: absolute; left: 12px; top: 50%; -webkit-transform: translateY(-50%); transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.busca input { padding-left: 40px; }

.filtros { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 14px; }
.filtros .span-all { grid-column: 1 / -1; }
@media (min-width: 900px) { .filtros { grid-template-columns: 1fr 1fr 1fr 2fr auto; align-items: end; } .filtros .span-all { grid-column: auto; } }

/* ---------- Listas ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list > li + li { border-top: 1px solid var(--border); }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 4px; color: var(--text); min-height: 56px; }
a.list-item:hover { background: var(--surface-2); border-radius: 8px; }
.list-item .title { font-weight: 600; }
.list-item .chev { color: var(--muted); width: 18px; height: 18px; }
.vazio { text-align: center; padding: 28px 12px; color: var(--muted); }
.vazio svg { width: 36px; height: 36px; margin: 0 auto 8px; display: block; opacity: .6; }

.avatar {
  flex: none; width: 42px; height: 42px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary-soft); color: var(--primary); font-weight: 700; font-size: .95rem;
}
.avatar-lg { width: 64px; height: 64px; font-size: 1.4rem; }

.quando { flex: none; width: 56px; text-align: center; font-variant-numeric: tabular-nums; }
.quando strong { display: block; font-size: 1rem; }
.quando small { color: var(--muted); font-size: .75rem; }

.badge { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px; font-size: .74rem; font-weight: 700; white-space: nowrap; }
.st-agendado { background: var(--info-soft); color: var(--info); }
.st-confirmado { background: var(--primary-soft); color: var(--primary); }
.st-realizado { background: var(--ok-soft); color: var(--ok); }
.st-cancelado { background: var(--surface-2); color: var(--muted); }
.st-faltou { background: var(--danger-soft); color: var(--danger); }
.badge-alergia { background: var(--danger-soft); color: var(--danger); }

/* ---------- Ficha do paciente ---------- */
.ficha-topo { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.ficha-topo .info { -webkit-box-flex: 1; flex: 1 1 220px; min-width: 0; }
.ficha-topo h1 { word-break: break-word; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { background: var(--surface-2); color: var(--muted); padding: 3px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; }

.dados { display: grid; gap: 12px 18px; grid-template-columns: minmax(0, 1fr); margin: 0; }
@media (min-width: 560px) { .dados { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.dados div { min-width: 0; }
.dados dt { font-size: .78rem; color: var(--muted); font-weight: 600; }
.dados dd { margin: 2px 0 0; word-break: break-word; }
.dados .full { grid-column: 1 / -1; }

.ficha-grid { display: grid; gap: 14px; margin-top: 14px; }
.ficha-grid > .card + .card { margin-top: 0; }
@media (min-width: 1000px) { .ficha-grid { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: start; } }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px 22px; }
.timeline li::before { content: ""; position: absolute; left: 5px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); }
.timeline li::after { content: ""; position: absolute; left: 9px; top: 18px; bottom: 0; width: 2px; background: var(--border); }
.timeline li:last-child::after { display: none; }
.timeline .cab { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.timeline .corpo { margin-top: 6px; font-size: .92rem; white-space: pre-wrap; word-break: break-word; }
.timeline .corpo b { font-weight: 600; color: var(--muted); font-size: .8rem; display: block; margin-top: 4px; }

.foto-ficha { border-radius: 10px; border: 1px solid var(--border); max-height: 420px; width: 100%; object-fit: contain; background: var(--surface-2); }
details { margin-top: 10px; }
summary { cursor: pointer; font-weight: 600; color: var(--primary); min-height: 32px; display: list-item; }
summary::-webkit-details-marker { color: var(--primary); }
pre.ocr { white-space: pre-wrap; word-break: break-word; background: var(--surface-2); padding: 12px; border-radius: 10px; font-size: .82rem; max-height: 320px; overflow: auto; -webkit-overflow-scrolling: touch; }

/* ---------- Importar fichas ---------- */
.captura { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 560px) { .captura { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.captura label.btn { min-height: 64px; font-size: 1rem; }
.captura input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; pointer-events: none; }
.dicas { margin: 12px 0 0; padding-left: 18px; color: var(--muted); font-size: .88rem; }

.ocr-card { margin-top: 14px; }
.ocr-cab { display: flex; gap: 12px; align-items: center; }
.ocr-cab img { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); flex: none; }
.ocr-corpo { margin-top: 14px; }
.ocr-card.salvo { border-color: var(--ok); }

.spinner {
  display: inline-block; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--border); border-top-color: var(--primary);
  -webkit-animation: girar .8s linear infinite; animation: girar .8s linear infinite;
}
@-webkit-keyframes girar { to { -webkit-transform: rotate(360deg); } }
@keyframes girar { to { transform: rotate(360deg); } }
.carregando { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 24px 4px; }
.carregando-tela { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 100vh; min-height: 100dvh; color: var(--muted); }

/* ---------- Seletor de paciente ---------- */
.seletor { position: relative; }
.seletor-lista { list-style: none; margin: 6px 0 0; padding: 4px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); max-height: 260px; overflow: auto; -webkit-overflow-scrolling: touch; }
.seletor-lista button { -webkit-appearance: none; appearance: none; width: 100%; text-align: left; background: none; border: 0; padding: 10px; border-radius: 8px; font: inherit; color: var(--text); min-height: 44px; cursor: pointer; }
.seletor-lista button:hover, .seletor-lista button:focus { background: var(--surface-2); }
.selecionado { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--primary); background: var(--primary-soft); border-radius: 10px; }

/* ---------- Login ---------- */
.login {
  min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center;
  padding: calc(24px + var(--safe-top)) 16px calc(24px + var(--safe-bottom));
}
.login .card { width: 100%; max-width: 420px; padding: 32px 24px; }
.login .brand { justify-content: center; font-size: 1.35rem; margin-bottom: 6px; }
.login .brand img { width: 40px; height: 40px; border-radius: 10px; }
.login form { display: grid; gap: 14px; margin-top: 20px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 16px); z-index: 100;
  -webkit-transform: translate(-50%, 20px); transform: translate(-50%, 20px);
  max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 12px;
  background: #13201f; color: #fff; font-weight: 600; font-size: .92rem; box-shadow: 0 8px 24px rgba(0,0,0,.25);
  opacity: 0; pointer-events: none; -webkit-transition: opacity .2s, -webkit-transform .2s; transition: opacity .2s, transform .2s;
}
.toast.visivel { opacity: 1; -webkit-transform: translate(-50%, 0); transform: translate(-50%, 0); }
.toast.erro { background: var(--danger); color: #fff; }
@media (min-width: 900px) { .toast { bottom: 24px; } }

/* ---------- Impressão da ficha ---------- */
@media print {
  .sidebar, .topbar, .tabbar, .toast, .head-actions, .actions, .voltar, .nao-imprimir { display: none !important; }
  .layout { display: block; }
  .view { padding: 0; max-width: none; }
  body { background: #fff; color: #000; }
  .card { box-shadow: none; border-color: #ccc; break-inside: avoid; page-break-inside: avoid; }
  .ficha-grid { display: block; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { -webkit-animation-duration: .01ms !important; animation-duration: .01ms !important; transition: none !important; }
}

/* ================= Multiempresa, login com abas, dashboard ================= */
:root { --chart: #0d9488; } /* validado: contraste 3:1+ sobre branco */

.nav-badge {
  display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 999px; background: var(--danger); color: #fff; font-size: .72rem; font-weight: 700; line-height: 1;
}
.icon-btn { position: relative; }
.icon-btn .dot { position: absolute; top: 8px; right: 8px; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); border: 2px solid #fff; }

.empresa-box { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; color: var(--primary); }
.empresa-box .grow { color: var(--text); display: flex; flex-direction: column; min-width: 0; }
.empresa-box small { font-size: .72rem; font-weight: 600; }
.empresa-box strong { font-size: .9rem; }
.empresa-box select { min-height: 32px; padding: 2px 28px 2px 0; border: 0; font-size: .9rem; font-weight: 700; background-position: right 2px center; box-shadow: none; }

/* Login: abas Entrar / Criar conta */
.abas { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin: 16px 0 0; background: var(--surface-2); border-radius: 12px; }
.abas button {
  -webkit-appearance: none; appearance: none; border: 0; background: transparent; min-height: 42px; border-radius: 9px;
  font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; touch-action: manipulation;
}
.abas button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.login .card.card-largo { max-width: 600px; }
.login fieldset { margin-bottom: 4px; }

/* Indicadores */
.stat .sub { font-size: .76rem; color: var(--muted); margin-top: 2px; }
.stats > .card { margin-top: 0; }

/* Grade do dashboard */
.dash-grid { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.dash-grid > .card + .card { margin-top: 0; }
@media (min-width: 900px) { .dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .span-dash { grid-column: 1 / -1; } }
.grafico h2 { margin-bottom: 2px; }
.grafico-sub { margin-bottom: 14px; }
.grafico h2 + .cc, .grafico h2 + .hb, .grafico h2 + .vazio { margin-top: 12px; }
.vazio-grafico { padding: 32px 12px; }

/* Colunas verticais */
.cc { display: flex; gap: 8px; }
.cc-eixo {
  display: flex; flex-direction: column; justify-content: space-between; height: 180px; min-width: 34px;
  font-size: .72rem; line-height: 1; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums;
}
.cc-eixo span:first-child { margin-top: -.35em; }
.cc-eixo span:last-child { margin-bottom: -.35em; }
.cc-area { -webkit-box-flex: 1; flex: 1 1 auto; min-width: 0; }
.cc-plot { position: relative; height: 180px; display: flex; align-items: flex-end; gap: 2px; border-bottom: 1px solid var(--muted); }
.cc-grade { position: absolute; top: 0; right: 0; bottom: 0; left: 0; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.cc-grade i { display: block; border-top: 1px dashed var(--border); }
.cc-grade i:last-child { border-top-color: transparent; }
.cc-col { position: relative; -webkit-box-flex: 1; flex: 1 1 0; height: 100%; display: flex; align-items: flex-end; justify-content: center; outline: none; border-radius: 6px 6px 0 0; }
.cc-col:hover, .cc-col:focus-visible { background: var(--surface-2); }
.cc-bar { display: block; width: 68%; max-width: 40px; min-height: 2px; background: var(--chart); border-radius: 4px 4px 0 0; }
.cc-lbl { position: absolute; left: -6px; right: -6px; margin-bottom: 4px; text-align: center; font-size: .72rem; font-weight: 700; color: var(--text); white-space: nowrap; pointer-events: none; }
.cc-x { display: flex; gap: 2px; margin-top: 6px; }
.cc-x span { -webkit-box-flex: 1; flex: 1 1 0; min-width: 0; text-align: center; font-size: .7rem; color: var(--muted); white-space: nowrap; overflow: hidden; }
@media (max-width: 599px) { .cc-muitos .cc-x span:nth-child(even) { visibility: hidden; } .cc-muitos .cc-x span { overflow: visible; } }

/* Barras horizontais */
.hb { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.hb li { display: grid; grid-template-columns: minmax(70px, 36%) minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 32px; padding: 0 6px; border-radius: 6px; outline: none; }
.hb li:hover, .hb li:focus-visible { background: var(--surface-2); }
.hb-rot { font-size: .86rem; }
.hb-trilho { display: block; height: 14px; }
.hb-bar { display: block; height: 100%; min-width: 2px; background: var(--chart); border-radius: 0 4px 4px 0; }
.hb-val { min-width: 2.5em; text-align: right; font-size: .86rem; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Tooltip */
.tip {
  position: fixed; left: 0; top: 0; z-index: 200; max-width: 260px; padding: 8px 10px; border-radius: 8px;
  background: #13201f; color: #fff; font-size: .82rem; font-weight: 600; line-height: 1.35;
  pointer-events: none; opacity: 0; -webkit-transition: opacity .12s; transition: opacity .12s;
}
.tip.visivel { opacity: 1; }

/* Tabela de apoio dos gráficos */
.tabela-dados { margin-top: 12px; }
.tabela-dados summary { font-size: .85rem; }
.tabela-rolagem { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tabela-dados table { width: 100%; border-collapse: collapse; font-size: .85rem; margin-top: 6px; }
.tabela-dados th, .tabela-dados td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.tabela-dados th { color: var(--muted); font-weight: 600; }
.tabela-dados th:not(:first-child), .tabela-dados td:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }

/* Empresas */
.chips-filtro { display: flex; gap: 8px; margin-bottom: 14px; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
.chip-f {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 8px 14px; border-radius: 999px; white-space: nowrap;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 600; font-size: .88rem;
}
.chip-f b { color: var(--muted); }
.chip-f.ativo { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip-f.ativo b { color: rgba(255, 255, 255, .85); }
.empresa-card { margin-bottom: 14px; }
.empresa-card + .empresa-card { margin-top: 0; }
.empresa-cab { display: flex; align-items: center; gap: 12px; }
.empresa-cab h2 { font-size: 1.1rem; }
.empresa-cab .chips { margin-top: 4px; }

@media print { .tip, .tabela-dados { display: none !important; } }

/* ================= ST3 IA — assistente ================= */
:root {
  --ia-roxo: #6d28d9;
  --ia-roxo-2: #7c3aed;
  --ia-amarelo: #facc15;
  --ia-verde: #22c55e;
  --ia-marinho: #0f172a;
}
.st3ia {
  position: fixed; z-index: 55; right: calc(14px + var(--safe-right));
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 14px);
}
@media (min-width: 900px) { .st3ia { right: 28px; bottom: 28px; } }
.st3ia-pill {
  -webkit-appearance: none; appearance: none; border: 0; cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px; min-height: 38px; padding: 5px 14px 5px 6px;
  border-radius: 999px; color: #fff; font: inherit; font-weight: 800; font-size: .88rem; letter-spacing: .02em;
  background: linear-gradient(135deg, var(--ia-roxo-2), var(--ia-roxo));
  box-shadow: 0 6px 18px rgba(109, 40, 217, .38), 0 1px 3px rgba(0, 0, 0, .15);
  -webkit-transition: -webkit-transform .15s; transition: transform .15s; touch-action: manipulation;
}
.st3ia-pill:hover { -webkit-transform: translateY(-1px); transform: translateY(-1px); }
.st3ia-pill:active { -webkit-transform: scale(.97); transform: scale(.97); }
.st3ia-pill:focus-visible { outline: 3px solid var(--ia-amarelo); outline-offset: 2px; }
.st3ia-nome b, .st3ia-tit b { color: var(--ia-amarelo); font-weight: 800; }
.st3ia-logo {
  display: inline-flex; align-items: center; justify-content: center; width: 27px; height: 27px; flex: none;
  border-radius: 8px; background: #fff;
}
.st3ia-logo svg { width: 21px; height: 21px; }
.st3ia-logo .hex { fill: var(--ia-marinho); }
.st3ia-logo .tres { fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.st3ia-logo.grande { width: 40px; height: 40px; border-radius: 12px; }
.st3ia-logo.grande svg { width: 30px; height: 30px; }

/* Ícone pequeno: liga/desliga a escuta de "MEDY" (área de toque maior que o ponto) */
.st3ia-escuta {
  -webkit-appearance: none; appearance: none; position: absolute; top: -13px; right: -12px;
  width: 32px; height: 32px; padding: 0; border: 0; background: transparent; cursor: pointer;
  display: flex; align-items: center; justify-content: center; touch-action: manipulation;
}
.st3ia-ponto { display: block; width: 14px; height: 14px; border-radius: 50%; background: #9ca3af; border: 3px solid #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.st3ia-escuta.ligada .st3ia-ponto { background: var(--ia-verde); }
.st3ia-escuta.ouvindo .st3ia-ponto { -webkit-animation: st3ia-pulso 1.6s ease-out infinite; animation: st3ia-pulso 1.6s ease-out infinite; }
.st3ia-escuta.erro .st3ia-ponto { background: #f59e0b; }
.st3ia-escuta:focus-visible { outline: 3px solid var(--ia-roxo); border-radius: 50%; }
@-webkit-keyframes st3ia-pulso { 0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, .55); } 70% { box-shadow: 0 0 0 10px rgba(34, 197, 94, 0); } 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); } }
@keyframes st3ia-pulso { 0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, .55); } 70% { box-shadow: 0 0 0 10px rgba(34, 197, 94, 0); } 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); } }
.st3ia.chamando .st3ia-pill { -webkit-animation: st3ia-chama 1s ease-in-out infinite; animation: st3ia-chama 1s ease-in-out infinite; }
@-webkit-keyframes st3ia-chama { 50% { box-shadow: 0 0 0 8px rgba(124, 58, 237, .25); } }
@keyframes st3ia-chama { 50% { box-shadow: 0 0 0 8px rgba(124, 58, 237, .25); } }

/* Tela da IA: tela cheia no celular, janela flutuante no computador */
.st3ia-painel {
  position: fixed; z-index: 60; display: flex; flex-direction: column; overflow: hidden;
  background: #fff; color: var(--text);
  top: 0; right: 0; bottom: 0; left: 0;
  padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);
}
.st3ia-painel[hidden] { display: none !important; }
@media (min-width: 600px) {
  .st3ia-painel {
    top: auto; left: auto; right: 24px; bottom: 80px; width: 400px;
    height: 620px; max-height: calc(100vh - 120px); max-height: calc(100dvh - 120px);
    padding: 0; border-radius: 18px; border: 1px solid var(--border);
    box-shadow: 0 20px 50px rgba(15, 23, 42, .22);
  }
}
@media (max-width: 599px) {
  html.st3ia-aberta .st3ia { display: none; }
  html.st3ia-aberta body { overflow: hidden; }
}

.st3ia-cab {
  display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 16px; color: #fff;
  background: linear-gradient(135deg, var(--ia-roxo-2), var(--ia-roxo));
}
.st3ia-tit { -webkit-box-flex: 1; flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.st3ia-tit strong { font-size: 1.1rem; font-weight: 800; }
.st3ia-tit small { font-size: .8rem; opacity: .92; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st3ia-x {
  -webkit-appearance: none; appearance: none; width: 44px; height: 44px; border: 0; border-radius: 12px; cursor: pointer;
  background: rgba(255, 255, 255, .16); color: #fff; display: inline-flex; align-items: center; justify-content: center;
}
.st3ia-x svg, .st3ia-mic svg, .st3ia-env svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.st3ia-msgs {
  -webkit-box-flex: 1; flex: 1 1 auto; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 16px; display: flex; flex-direction: column; gap: 10px; background: #faf8ff;
}
.st3ia-msg { max-width: 88%; padding: 10px 14px; border-radius: 16px; font-size: .95rem; line-height: 1.45; word-break: break-word; }
.st3ia-msg p { margin: 0; }
.st3ia-msg.ia { align-self: flex-start; background: #fff; border: 1px solid #ebe5fb; border-bottom-left-radius: 6px; }
.st3ia-msg.eu { align-self: flex-end; background: var(--ia-roxo); color: #fff; border-bottom-right-radius: 6px; }
.st3ia-msg.erro { border-color: var(--danger-soft); color: var(--danger); }
.st3ia-msg.carregando { display: inline-flex; gap: 5px; padding: 14px 16px; }
.st3ia-msg.carregando span { width: 7px; height: 7px; border-radius: 50%; background: var(--ia-roxo-2); opacity: .35; -webkit-animation: st3ia-pontos 1s infinite; animation: st3ia-pontos 1s infinite; }
.st3ia-msg.carregando span:nth-child(2) { -webkit-animation-delay: .15s; animation-delay: .15s; }
.st3ia-msg.carregando span:nth-child(3) { -webkit-animation-delay: .3s; animation-delay: .3s; }
@-webkit-keyframes st3ia-pontos { 50% { opacity: 1; } }
@keyframes st3ia-pontos { 50% { opacity: 1; } }
.st3ia-itens { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.st3ia-itens a { display: flex; flex-direction: column; padding: 8px 10px; border-radius: 10px; background: #f5f3ff; color: var(--text); }
.st3ia-itens small { color: var(--muted); font-size: .8rem; }
.st3ia-link { display: inline-block; margin-top: 8px; font-weight: 700; color: var(--ia-roxo); }

.st3ia-sug { display: flex; gap: 8px; padding: 10px 12px; overflow-x: auto; -webkit-overflow-scrolling: touch; border-top: 1px solid #efeaf9; background: #fff; }
.st3ia-sug.dentro { padding: 8px 0 0; border: 0; background: transparent; flex-wrap: wrap; overflow: visible; }
.st3ia-sug button {
  -webkit-appearance: none; appearance: none; flex: none; min-height: 36px; padding: 6px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid #ddd3f7; background: #f5f3ff; color: var(--ia-roxo); font: inherit; font-size: .85rem; font-weight: 600; white-space: nowrap;
}
.st3ia-entrada { display: flex; align-items: center; gap: 8px; padding: 10px 12px 12px; background: #fff; }
.st3ia-entrada input { -webkit-box-flex: 1; flex: 1 1 auto; min-width: 0; border-radius: 999px; padding-left: 16px; }
.st3ia-entrada input:focus { border-color: var(--ia-roxo-2); box-shadow: 0 0 0 3px #ede9fe; }
.st3ia-mic, .st3ia-env {
  -webkit-appearance: none; appearance: none; flex: none; width: 48px; height: 48px; border-radius: 50%; border: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; touch-action: manipulation;
}
.st3ia-mic { background: #ede9fe; color: var(--ia-roxo); }
.st3ia-mic.ativo { background: var(--ia-roxo); color: #fff; -webkit-animation: st3ia-mic 1.4s ease-out infinite; animation: st3ia-mic 1.4s ease-out infinite; }
@-webkit-keyframes st3ia-mic { 0% { box-shadow: 0 0 0 0 rgba(124, 58, 237, .5); } 70% { box-shadow: 0 0 0 12px rgba(124, 58, 237, 0); } 100% { box-shadow: 0 0 0 0 rgba(124, 58, 237, 0); } }
@keyframes st3ia-mic { 0% { box-shadow: 0 0 0 0 rgba(124, 58, 237, .5); } 70% { box-shadow: 0 0 0 12px rgba(124, 58, 237, 0); } 100% { box-shadow: 0 0 0 0 rgba(124, 58, 237, 0); } }
.st3ia-env { background: var(--ia-roxo); color: #fff; }

@media print { .st3ia, .st3ia-painel { display: none !important; } }

/* Conta: aprovação de novos cadastros (somente admin master) */
.aprovacoes { margin-bottom: 14px; border-color: #c7d7fe; }
.aprovacoes > h2 { justify-content: flex-start; flex-wrap: wrap; }
.aprovacoes > h2 svg { color: var(--primary); }
.aprovacoes > h2 .btn-ghost { margin-left: auto; }
.aprovacoes .empresa-card { margin: 12px 0 0; box-shadow: none; background: var(--sidebar-bg); }

/* LED da ST3 IA: estados extras */
.st3ia-escuta.erro .st3ia-ponto { background: #ea580c; }
.st3ia-escuta.aguardando .st3ia-ponto { background: #f59e0b; -webkit-animation: st3ia-pisca 1s steps(2, start) infinite; animation: st3ia-pisca 1s steps(2, start) infinite; }
.st3ia-escuta.indisponivel .st3ia-ponto { background: #cbd5e1; }
@-webkit-keyframes st3ia-pisca { to { opacity: .35; } }
@keyframes st3ia-pisca { to { opacity: .35; } }

/* Conta: palavras de comando da ST3 IA */
.ia-palavras { margin-top: 14px; }
.ia-palavras > h2 { justify-content: flex-start; }
.st3ia-mini {
  display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 800;
  color: #fff; background: linear-gradient(135deg, var(--ia-roxo-2), var(--ia-roxo));
}
.st3ia-mini b { color: var(--ia-amarelo); margin-left: 3px; }
.ia-colunas { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); margin-top: 12px; }
@media (min-width: 900px) { .ia-colunas { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.ia-colunas h3 { margin-bottom: 8px; }
.ia-lista { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ia-lista li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 10px; border-radius: 10px; background: #faf8ff; border: 1px solid #efeaf9; }
.ia-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.ia-chip { padding: 2px 9px; border-radius: 999px; background: #ede9fe; color: var(--ia-roxo); font-size: .8rem; font-weight: 700; }
.ia-chip.destaque { background: var(--ia-roxo); color: #fff; }
.ia-chip.ensinada { background: #fef3c7; color: #92400e; }
.ia-seta { font-size: .85rem; color: var(--muted); }
.ia-seta strong { color: var(--text); }
.ia-form { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.ia-form [hidden] { display: none !important; }

/* Troca de senha obrigatória: requisitos marcados conforme a digitação */
.regras-senha { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: .85rem; color: var(--muted); }
.regras-senha li::before { content: "○"; display: inline-block; width: 1.3em; font-weight: 700; }
.regras-senha li.ok { color: var(--ok); }
.regras-senha li.ok::before { content: "✓"; }

/* Conta: backup e restauração (admin master) */
.backup { margin-top: 14px; border-color: #fcd9bd; }
.backup > h2 { justify-content: flex-start; }
.backup-grid { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); margin-top: 10px; }
@media (min-width: 900px) { .backup-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.backup-grid h3 { margin-bottom: 6px; }
.backup-grid p { margin-bottom: 10px; }
.backup .alerta { margin: 8px 0; }
.bk-dobra { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; margin: 10px 0; }
.bk-dobra > summary { cursor: pointer; font-weight: 700; min-height: 28px; }
.bk-dobra[open] > summary { margin-bottom: 8px; }
.bk-passos { padding-left: 20px; margin: 0; }
.bk-passos li { margin-bottom: 8px; }
.bk-copiar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; }
.bk-copiar code { background: var(--info-soft); border-radius: 8px; padding: 6px 8px; overflow-wrap: anywhere; -webkit-user-select: all; user-select: all; }
.bk-agenda { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 10px; }
.bk-agenda input[type="time"] { width: auto; min-width: 110px; }
.bk-check { display: inline-flex; align-items: center; gap: 8px; }
.bk-check input[type="checkbox"] { width: 20px; min-width: 20px; height: 20px; min-height: 0; padding: 0; margin: 0; -webkit-appearance: auto; appearance: auto; accent-color: var(--primary, #0f766e); }
@media (min-width: 900px) { .bk-larga { grid-column: 1 / -1; } }
.bk-lista { list-style: none; margin: 0; padding: 0; }
.bk-lista li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; border-top: 1px solid var(--border); }
.sidebar-user .versao { margin-top: 4px; font-size: .75rem; opacity: .8; }

/* Importar fichas: revisão com a foto ao lado dos campos */
.ocr-progresso { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: var(--info-soft); color: var(--info); font-weight: 600; font-size: .9rem; }
.ocr-revisao { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 1000px) { .ocr-revisao { grid-template-columns: minmax(260px, 2fr) minmax(0, 3fr); } }
.ocr-foto { position: -webkit-sticky; position: sticky; top: 12px; }
.ocr-foto img { width: 100%; max-height: 560px; object-fit: contain; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); cursor: zoom-in; }
.ocr-foto-acoes { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.ocr-foto-acoes .btn { -webkit-box-flex: 1; flex: 1 1 auto; }
@media (max-width: 999px) { .ocr-foto { position: static; } .ocr-foto img { max-height: 320px; } }
/* campos preenchidos pela leitura (somem ao editar) */
.ocr-card input.lido, .ocr-card select.lido, .ocr-card textarea.lido { background: #f0fdf4; border-color: #86efac; }

/* no celular o aviso fica acima do botão MEDY IA (que fica sobre a barra de abas) */
@media (max-width: 899px) { .toast { bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 74px); } }

/* ================= Seleção de plataforma (login e cadastro) ================= */
.plataformas { margin: 0; }
.plataformas legend { font-size: .82rem; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.plataformas-opcoes { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.plataforma-opcao {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-height: 92px;
  padding: 12px; border: 2px solid var(--border); border-radius: 12px; background: var(--surface); cursor: pointer;
  -webkit-transition: border-color .15s, background .15s; transition: border-color .15s, background .15s;
}
.plataforma-opcao input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.plataforma-icone { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px; background: var(--surface-2); color: var(--muted); }
.plataforma-texto { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.plataforma-texto strong { font-size: .92rem; line-height: 1.2; }
.plataforma-texto small { font-size: .74rem; color: var(--muted); line-height: 1.3; }
.plataforma-opcao:hover { border-color: #b6d9d4; }
.plataforma-opcao:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.plataforma-opcao:has(input:checked) .plataforma-icone { background: var(--primary); color: #fff; }
.plataforma-opcao.marcada { border-color: var(--primary); background: var(--primary-soft); }
.plataforma-opcao.marcada .plataforma-icone { background: var(--primary); color: #fff; }
.plataforma-opcao:has(input:focus-visible) { outline: 3px solid var(--primary-soft); outline-offset: 2px; }
@media (max-width: 359px) { .plataformas-opcoes { grid-template-columns: minmax(0, 1fr); } }

.btn-plataforma { margin-top: auto; justify-content: flex-start; color: var(--primary); }
.empresa-plataformas { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 10px; }
.chk-plataforma { display: inline-flex; align-items: center; gap: 6px; font-size: .88rem; font-weight: 600; cursor: pointer; }
.chk-plataforma input { width: 18px; height: 18px; min-height: 0; -webkit-appearance: checkbox; appearance: auto; }
.chk-plataforma svg { width: 16px; height: 16px; }

.btn-plataforma + .sidebar-user { margin-top: 8px; }

/* botão Sair no menu lateral, abaixo do nome do usuário */
.sidebar-user .btn-sair { margin-top: 10px; justify-content: flex-start; color: var(--danger); background: #fff; border-color: var(--border); }
.sidebar-user .btn-sair:hover { background: var(--danger-soft); border-color: var(--danger-soft); }
.cli-plataforma select { min-height: 30px; padding: 2px 26px 2px 0; border: 0; font-size: .9rem; font-weight: 700; background-position: right 2px center; box-shadow: none; }
@media (min-width: 900px) { .sidebar { overflow-y: auto; } }

/* cadastro: plataformas como caixas de marcar (uma ou as duas) */
.plataforma-opcao.multipla::after {
  content: ""; position: absolute; top: 10px; right: 10px; width: 18px; height: 18px; border-radius: 5px;
  border: 2px solid var(--border); background: #fff;
}
.plataforma-opcao.multipla.marcada::after, .plataforma-opcao.multipla:has(input:checked)::after {
  border-color: var(--primary); background: var(--primary) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5 9-10'/%3E%3C/svg%3E") center / 12px no-repeat;
}
/* aprovação: destaque do acesso solicitado */
.empresa-plataformas.pendente { padding: 10px 12px; border-radius: 10px; background: var(--warn-soft); }
.empresa-plataformas.pendente .muted { color: var(--warn); font-weight: 700; }

/* ===== Conteúdo das telas (Hospital e Clínica Médica): negrito com alto-relevo ===== */
.view, .cli-modal, .pr-modal {
  font-weight: 700;
  text-shadow: -1px -1px 0 rgba(255, 255, 255, .9), 1px 1px 1px rgba(15, 23, 42, .2);
}
.view *, .cli-modal *, .pr-modal * { font-weight: 700 !important; }
.view h1, .cli-modal h1, .view .stat .num { font-weight: 800 !important; }
/* texto branco sobre fundo colorido: relevo com sombra escura para continuar legível */
.view .btn-primary, .cli-modal .btn-primary, .view .chip-f.ativo, .view .nav-badge, .cli-modal .nav-badge,
.view .st3ia-mini, .view .ia-chip.destaque, .view .plataforma-opcao.marcada .plataforma-icone, .cli-modal .btn-primary * {
  text-shadow: 0 1px 1px rgba(0, 0, 0, .35);
}
.view input::placeholder, .cli-modal input::placeholder, .view textarea::placeholder, .cli-modal textarea::placeholder { font-weight: 600; }

/* ===== Perfis: o analista não vê as ações de exclusão (o servidor também bloqueia) ===== */
html.sem-gestao [data-excluir], html.sem-gestao #btn-excluir, html.sem-gestao #btn-excluir-at,
html.sem-gestao [data-cancelar-pacote], html.sem-gestao [data-estornar], html.sem-gestao [data-desfazer],
html.sem-gestao [data-pagar-rep], html.sem-gestao [data-exemplo], html.sem-gestao [data-apagar-palavra] { display: none !important; }

/* ===== Equipe: perfil, desativar e remover ===== */
.equipe-item { flex-wrap: wrap; row-gap: 8px; }
.equipe-item.inativo .avatar, .equipe-item.inativo .title { opacity: .55; }
.equipe-acoes { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.equipe-acoes select { font-size: 16px; padding: 6px 30px 6px 10px; min-height: 36px; border-radius: 10px; }
.equipe-acoes .perigo { color: var(--danger, #b91c1c); }
@media (max-width: 640px) { .equipe-acoes { width: 100%; padding-left: 52px; } }
