/* ProntPSI — identidade visual inspirada nas telas de referência (painéis azul-claro, cabeçalhos azuis, ações laranja) */
:root {
  --azul: #1a56db;
  --azul-escuro: #1e3a8a;
  --azul-texto: #1e40af;
  --azul-painel: #cfe0fb;
  --azul-cabecalho: #a8c7f6;
  --azul-linha: #eef4fe;
  --laranja: #ff9800;
  --laranja-escuro: #f57c00;
  --verde: #16a34a;
  --cinza-borda: #dbe3ef;
  --texto: #1f2937;
  --texto-suave: #6b7280;
  --sidebar-w: 150px;
  --header-h: 40px;
  --bs-font-sans-serif: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

html, body { height: 100%; }
body {
  font-family: var(--bs-font-sans-serif);
  font-size: 12px;
  color: var(--texto);
  background: #f4f7fc;
}
a { color: var(--azul); text-decoration: none; }
.text-azul { color: var(--azul-texto) !important; }
.text-laranja { color: var(--laranja-escuro) !important; }
.fw-600 { font-weight: 600; }
.small-xs { font-size: 10.5px; }

/* ---------- Topo ---------- */
.app-header {
  position: fixed; inset: 0 0 auto 0; height: var(--header-h); z-index: 1030;
  background: #fff; border-bottom: 1px solid var(--cinza-borda);
  display: flex; align-items: center; padding: 0 14px; gap: 18px;
  box-shadow: 0 1px 4px rgba(16, 24, 40, .06);
}
.app-logo { display: flex; align-items: center; gap: 6px; width: calc(var(--sidebar-w) - 14px); }
.app-logo .logo-mark {
  width: 26px; height: 26px; border-radius: 6px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--laranja), #ff5722); color: #fff; font-weight: 800; font-size: 13px;
}
.app-logo .logo-text { line-height: 1; font-weight: 800; color: var(--azul); font-size: 15px; letter-spacing: .5px; }
.app-logo .logo-text small { display: block; font-size: 7px; letter-spacing: 3px; color: var(--laranja); font-weight: 600; }
.saudacao { font-weight: 600; font-size: 11px; display: flex; align-items: center; gap: 6px; }
.saudacao .bi-brightness-high-fill { color: #fbbf24; }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.header-right .bi-bell { color: #9ca3af; font-size: 13px; }
.unidade-seletor { display: flex; align-items: center; gap: 8px; }
.unidade-seletor .bi-geo-alt-fill { color: var(--laranja); font-size: 14px; }
.unidade-seletor .nome { font-weight: 700; font-size: 10.5px; line-height: 1.1; }
.unidade-seletor .municipio { font-size: 9px; color: var(--texto-suave); }
.avatar {
  width: 26px; height: 26px; border-radius: 50%; background: #8fb4f5; color: #fff;
  display: inline-grid; place-items: center; font-weight: 700; font-size: 10.5px; position: relative; flex-shrink: 0;
}
.avatar.lg { width: 32px; height: 32px; font-size: 12px; background: #dbe7fd; color: var(--azul); }
.avatar .dot { position: absolute; right: -1px; bottom: -1px; width: 8px; height: 8px; border-radius: 50%; background: var(--verde); border: 2px solid #fff; }

/* ---------- Menu lateral ---------- */
.app-sidebar {
  position: fixed; top: var(--header-h); bottom: 0; left: 0; width: var(--sidebar-w); z-index: 1020;
  background: #fff; border-right: 1px solid var(--cinza-borda); padding: 14px 6px 50px; overflow-y: auto;
}
.menu-grupo { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px; font-weight: 700; font-size: 11px; cursor: pointer; color: var(--texto); }
.menu-grupo .bi-chevron-up { font-size: 9px; transition: transform .2s; }
.menu-grupo.collapsed .bi-chevron-up { transform: rotate(180deg); }
.menu-item {
  display: flex; align-items: center; gap: 7px; padding: 7px 10px; margin: 3px 0; border-radius: 6px;
  font-weight: 600; font-size: 10.5px; color: var(--texto);
}
.menu-item.sub { padding-left: 16px; }
.menu-item:hover { background: #eef3fd; color: var(--azul); }
.menu-item.active { background: var(--azul); color: #fff; box-shadow: 0 2px 6px rgba(26, 86, 219, .35); }
.menu-item i { font-size: 12px; width: 14px; text-align: center; }
.menu-sep { font-size: 9px; text-transform: uppercase; letter-spacing: .08em; color: var(--texto-suave); padding: 12px 10px 2px; font-weight: 700; }
.sidebar-rodape { position: fixed; bottom: 0; left: 0; width: var(--sidebar-w); padding: 8px 12px; background: #fff; border-top: 1px solid var(--cinza-borda); font-size: 9px; color: var(--texto-suave); }

/* ---------- Área principal ---------- */
.app-main { margin-left: var(--sidebar-w); padding: calc(var(--header-h) + 10px) 12px 40px; min-height: 100vh; }
.page-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.page-head .icone {
  width: 28px; height: 28px; border-radius: 6px; background: #dbe7fd; color: var(--azul-escuro);
  display: grid; place-items: center; font-size: 14px;
}
.page-head h1 { font-size: 13px; font-weight: 700; margin: 0; color: var(--azul-escuro); }
.page-head p { font-size: 10px; margin: 0; color: var(--texto-suave); }
.page-head .acoes { margin-left: auto; display: flex; gap: 6px; align-items: center; }

.painel { background: var(--azul-painel); border-radius: 8px; padding: 10px; margin-bottom: 10px; }
.painel-titulo {
  background: var(--azul-cabecalho); border-radius: 6px 6px 0 0; padding: 7px 10px; font-weight: 700; font-size: 12px;
  display: flex; align-items: center; gap: 6px; color: var(--azul-escuro);
}
.painel-titulo .badge-cont { background: #fff; color: var(--azul-escuro); border-radius: 4px; padding: 1px 6px; font-size: 9px; }
.cartao { background: #fff; border-radius: 6px; box-shadow: 0 1px 2px rgba(16, 24, 40, .06); }
.label-busca { font-size: 10.5px; font-weight: 600; color: var(--azul-escuro); margin-bottom: 3px; }
.caixa-busca { background: var(--azul-cabecalho); border-radius: 6px; padding: 6px 6px; }

/* Botões */
.btn { font-size: 10.5px; font-weight: 600; border-radius: 5px; padding: 4px 10px; }
.btn-sm { font-size: 10px; padding: 3px 8px; }
.btn-azul { background: var(--azul); color: #fff; border: 0; box-shadow: 0 1px 2px rgba(0,0,0,.15); }
.btn-azul:hover { background: #1747b8; color: #fff; }
.btn-laranja { background: var(--laranja); color: #fff; border: 0; box-shadow: 0 1px 2px rgba(0,0,0,.15); }
.btn-laranja:hover { background: var(--laranja-escuro); color: #fff; }
.btn-branco { background: #fff; border: 1px solid var(--cinza-borda); color: var(--texto); }
.btn-icone { width: 26px; height: 22px; padding: 0; display: inline-grid; place-items: center; border-radius: 4px; border: 0; color: #fff; font-size: 11px; }
.btn-icone.azul { background: var(--azul); } .btn-icone.roxo { background: #7c3aed; } .btn-icone.verde { background: #0d9488; }
.btn-icone.vermelho { background: #dc2626; } .btn-icone.laranja { background: var(--laranja); } .btn-icone.cinza { background: #64748b; }
.btn-acao-lista { background: none; border: 0; color: #111827; font-size: 13px; padding: 2px 6px; }
.btn-acao-lista:hover { color: var(--azul); }

/* Tabelas no estilo das telas */
.tabela { width: 100%; border-collapse: separate; border-spacing: 0; background: #fff; border-radius: 6px; overflow: hidden; }
.tabela thead th {
  background: var(--azul-cabecalho); color: var(--azul-escuro); font-size: 10.5px; font-weight: 700; padding: 8px 10px;
  border-right: 2px solid rgba(255,255,255,.0); position: relative;
}
.tabela thead th + th::before { content: ""; position: absolute; left: 0; top: 7px; bottom: 7px; width: 2px; background: var(--azul-escuro); opacity: .55; }
.tabela tbody td { padding: 10px; font-size: 10.5px; border-bottom: 1px solid #edf1f7; vertical-align: middle; }
.tabela tbody tr:nth-child(even) td { background: #f8fafc; }
.tabela tbody tr:hover td { background: var(--azul-linha); }
.tabela .rodape td { background: #e5e7eb !important; }
.tabela-vazia { text-align: center; padding: 26px 10px !important; }
.tabela-vazia .ilustracao { font-size: 46px; color: var(--laranja); opacity: .85; }
.tabela-vazia .msg { color: var(--azul-texto); font-weight: 700; font-size: 13px; margin-top: 4px; }

.bloco-paciente b { font-weight: 700; }
.bloco-paciente div { line-height: 1.55; }
.status-pill { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 9px; font-weight: 600; }
.status-pill.ativo { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }
.status-pill.inativo { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }
.status-pill.liberado { background: #e0f2fe; color: #0369a1; }
.status-pill.espera { background: #fef3c7; color: #b45309; }
.status-pill.andamento { background: #dbeafe; color: #1d4ed8; }
.status-pill.cancelado { background: #f1f5f9; color: #64748b; }
.status-pill.prioridade { background: #fee2e2; color: #b91c1c; }
.status-pill.triagem { background: #e0e7ff; color: #3730a3; }
.tag-sexo { background: #f472b6; color: #fff; border-radius: 3px; padding: 0 5px; font-size: 9px; font-weight: 600; }
.tag-sexo.m { background: #60a5fa; }
.tag-sala { display: inline-block; border: 1px solid #93c5fd; color: var(--azul); background: #eff6ff; border-radius: 3px; padding: 0 5px; font-size: 9px; }
.tag-data { display: inline-flex; align-items: center; gap: 4px; background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 3px; padding: 1px 6px; font-size: 9.5px; }

/* Contadores (Recepção / Em Atendimento / Concluídos) */
.contador { background: #fff; border-radius: 6px; padding: 10px 12px; display: flex; gap: 10px; position: relative; overflow: hidden; min-height: 62px; }
.contador .ico { width: 26px; height: 26px; border-radius: 6px; display: grid; place-items: center; font-size: 13px; }
.contador .ico.azul { background: #dbe7fd; color: var(--azul); }
.contador .ico.laranja { background: #ffedd5; color: var(--laranja); }
.contador .ico.verde { background: #dcfce7; color: var(--verde); }
.contador .titulo { font-size: 9.5px; color: var(--texto-suave); }
.contador .valor { font-size: 22px; font-weight: 700; color: var(--azul-escuro); line-height: 1.1; margin-top: 6px; }
.contador.ativo::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: #15803d; }

/* Formulários */
.form-control, .form-select { font-size: 11px; border-color: var(--cinza-borda); }
.form-control-sm, .form-select-sm { min-height: 26px; padding: 3px 8px; font-size: 10.5px; }
.form-label { font-size: 10.5px; font-weight: 600; margin-bottom: 2px; color: #374151; }
.form-check-input { margin-top: .15em; }
.form-check-label { font-size: 10.5px; }
.form-text { font-size: 9.5px; }
.invalid-feedback { font-size: 9.5px; }
.form-switch .form-check-input { width: 2.2em; }
.campo-erro .form-control, .campo-erro .form-select { border-color: #dc2626; }
ul.lista-checks { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 4px 16px; }
ul.lista-checks label { font-size: 10.5px; display: flex; align-items: center; gap: 5px; }

/* Autocomplete */
.autocomplete { position: relative; }
.autocomplete .ac-icon { background: #fff; font-size: 10px; color: #6b7280; }
.ac-results {
  display: none; position: absolute; left: 0; right: 0; top: 100%; z-index: 1060; background: #fff;
  border: 1px solid var(--cinza-borda); border-radius: 0 0 6px 6px; max-height: 280px; overflow-y: auto;
}
.ac-results.show { display: block; }
.ac-item { display: flex; align-items: center; gap: 10px; padding: 7px 10px; cursor: pointer; border-bottom: 1px solid #f1f5f9; }
.ac-item:hover, .ac-item.focado { background: #e8f0fe; }
.ac-item .ac-title { font-weight: 700; font-size: 10.5px; }
.ac-item .ac-sub, .ac-item .ac-meta { font-size: 9.5px; color: #374151; }
.ac-item .ac-badge { margin-left: auto; display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 10px; }
.ac-item .ac-badge i { background: #dc2626; color: #fff; border-radius: 3px; padding: 2px 4px; }
.ac-vazio { padding: 8px 10px; color: var(--texto-suave); font-size: 10px; }
.ac-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 4px; }
.ac-chip { background: #e0ebff; color: var(--azul-escuro); border-radius: 4px; padding: 1px 4px 1px 7px; font-size: 10px; display: inline-flex; align-items: center; gap: 4px; }
.ac-chip-remove { border: 0; background: none; color: var(--azul-escuro); font-size: 13px; line-height: 1; padding: 0 2px; }

/* Modal */
.modal-content { border-radius: 8px; border: 0; }
.modal-header { border: 0; padding: 12px 16px 4px; }
.modal-header .icone { width: 30px; height: 30px; border-radius: 6px; background: #eef3fd; display: grid; place-items: center; color: var(--azul-escuro); }
.modal-title { font-size: 12px; font-weight: 700; }
.modal-sub { font-size: 10px; color: var(--texto-suave); }
.modal .btn-close-box { border: 1px solid var(--cinza-borda); border-radius: 5px; width: 26px; height: 26px; display: grid; place-items: center; background: #fff; }
.modal-body .painel { margin: 0; }

/* Registro do atendimento (prontuário) */
.secao { background: #fff; border-radius: 6px; margin-bottom: 10px; overflow: hidden; border: 1px solid #c7dafa; }
.secao-cabecalho { display: flex; align-items: center; gap: 8px; padding: 6px 10px; font-weight: 600; font-size: 10.5px; }
.secao-cabecalho .num { width: 17px; height: 17px; border-radius: 3px; display: grid; place-items: center; font-size: 9.5px; font-weight: 700; }
.secao-cabecalho .toggle { margin-left: auto; color: #374151; }
.secao-corpo { padding: 8px 10px 10px; }
.secao.verde .secao-cabecalho { background: #d1f0dc; } .secao.verde .num { background: #a7e3bd; }
.secao.rosa .secao-cabecalho { background: #f9dde6; } .secao.rosa .num { background: #f3b8cb; }
.secao.laranja .secao-cabecalho { background: #fde6cf; } .secao.laranja .num { background: #fbcf9f; }
.secao.lilas .secao-cabecalho { background: #e7ddf7; } .secao.lilas .num { background: #cdb9ef; }
.secao.azul .secao-cabecalho { background: #d6e5fc; color: var(--azul-escuro); font-weight: 700; }
.secao-info { font-size: 9.5px; color: var(--azul-escuro); padding: 4px 10px; background: #eef4fe; }
.confidencial { font-size: 9px; color: var(--azul-escuro); margin-left: auto; }
.tabela-aspectos { width: 100%; font-size: 10px; }
.tabela-aspectos th { background: #f1f5f9; padding: 5px 6px; font-weight: 700; border: 1px solid #e5e7eb; }
.tabela-aspectos td { padding: 4px 6px; border: 1px solid #eef2f7; }
.linha-registro { border: 1px solid #edf1f7; border-radius: 5px; padding: 6px 8px; margin-top: 6px; font-size: 10.5px; background: #fbfdff; }
.linha-registro .meta { font-size: 9.5px; color: var(--texto-suave); }

/* Editor rich text */
.rt-wrap { border-bottom: 1px solid #9ca3af; }
.rt-toolbar { background: #dbe7fd; border-radius: 4px; padding: 2px 6px; display: flex; gap: 2px; }
.rt-toolbar button { border: 0; background: none; font-size: 11px; width: 22px; height: 20px; border-radius: 3px; color: #111827; }
.rt-toolbar button:hover, .rt-toolbar button.on { background: #bcd3fb; }
.rt-editor { min-height: 90px; padding: 8px 6px; outline: none; font-size: 11px; }
.rt-editor:empty::before { content: attr(data-placeholder); color: #9ca3af; font-style: italic; font-size: 10px; }
.rt-editor ul, .rt-editor ol { padding-left: 18px; margin: 0; }
.conteudo-rico p { margin-bottom: .35rem; }

/* Abas */
.nav-abas .nav-link { font-size: 10.5px; font-weight: 600; padding: 6px 12px; color: var(--azul-escuro); border-radius: 6px 6px 0 0; }
.nav-abas .nav-link.active { background: #fff; color: var(--azul); border-color: #fff; }

/* Rodapé e botão flutuante */
.app-footer { margin-left: var(--sidebar-w); text-align: center; font-size: 9.5px; color: #374151; padding: 6px; }
.fab-suporte { position: fixed; right: 14px; bottom: 14px; width: 36px; height: 36px; border-radius: 50%; background: var(--laranja); color: #fff; display: grid; place-items: center; font-size: 17px; box-shadow: 0 4px 10px rgba(0,0,0,.2); z-index: 1040; }
.fab-suporte:hover { color: #fff; background: var(--laranja-escuro); }

.alert { font-size: 11px; padding: 7px 12px; }
.paginacao { display: flex; justify-content: flex-end; align-items: center; gap: 12px; padding: 10px 12px; }
.paginacao a, .paginacao span { font-size: 11px; color: var(--azul); }
.paginacao .atual { color: #111827; font-weight: 600; }

/* Login */
.login-bg { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, #1e3a8a 0%, #1a56db 55%, #60a5fa 100%); }
.login-card { width: 360px; background: #fff; border-radius: 12px; padding: 28px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }

/* Impressão */
@media print {
  .app-header, .app-sidebar, .app-footer, .fab-suporte, .no-print, .sidebar-rodape { display: none !important; }
  .app-main { margin: 0; padding: 0; }
  body { background: #fff; }
}

@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }
  .app-sidebar { transform: translateX(-100%); width: 200px; transition: transform .2s; }
  body.menu-aberto .app-sidebar { transform: none; }
  .app-logo { width: auto; }
  .saudacao { display: none; }
}

/* O Bootstrap aumenta a fonte dentro de .input-group-sm; mantém o padrão compacto das telas */
.input-group-sm > .form-control, .input-group-sm > .input-group-text { font-size: 10.5px; min-height: 26px; }
.caixa-busca .input-group-sm > .form-control { font-size: 11px; }

/* Busca ao vivo: barra de progresso no topo e lista esmaecida enquanto carrega */
body.live-carregando::before {
  content: ""; position: fixed; top: var(--header-h); left: 0; height: 2px; width: 40%; z-index: 1050;
  background: var(--laranja); animation: live-barra 0.9s ease-in-out infinite;
}
body.live-carregando .app-main .tabela, body.live-carregando .app-main .contador { opacity: .55; transition: opacity .15s; }
@keyframes live-barra { from { left: -40%; } to { left: 100%; } }
.busca-viva-dica { font-size: 9.5px; color: var(--texto-suave); }
