body {
  background: #fff;
}

.ce-page {
  color: #212529;
}

.ce-shell {
  width: 100%;
  margin: 0 auto;
}

.ce-top {
  position: relative;
  z-index: 1;
}

.ce-title-block {
  min-width: 0;
}

.ce-title-block h2 {
  margin: 0;
}

.ce-title-block .subtitle {
  margin: 0;
}

.ce-title-icon {
  width: 40px;
  height: 40px;
  margin-right: .5rem;
  object-fit: contain;
  flex: 0 0 auto;
}

.ce-top-actions {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}

.ce-alerts {
  display: grid;
  gap: 8px;
  min-height: 10px;
  margin: 14px 0;
}

.ce-alert {
  border: 1px solid #e9ecef;
  border-left: 4px solid #007bff;
  border-radius: .5rem;
  background: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .05);
  padding: 10px 12px;
  color: #212529;
  font-size: 14px;
}

.ce-alert.warning {
  border-left-color: #ffc107;
}

.ce-alert.danger {
  border-left-color: #dc3545;
}

/* Navegacao por abas - mesmo padrao visual ja usado em
   /relatorios/gerenciais.html (rg-tabs/rg-panel), reaproveitado aqui com
   prefixo proprio (ce-) para nao acoplar aos dois modulos. */
.ce-tabs {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 4px 0 14px;
  background: #fff;
}

.ce-tab {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  min-height: 38px;
  border: 1px solid #dee2e6;
  border-radius: 999px;
  background: #fff;
  color: #6c757d;
  padding: .5rem .9rem;
  font-size: .85rem;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
}

.ce-tab img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.ce-tab.is-active {
  color: #fff;
  background: #007bff;
  border-color: #007bff;
}

.ce-panel {
  display: none;
}

.ce-panel.is-active {
  display: block;
}

.ce-section-head,
.ce-block-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin: 10px 0 14px;
}

.ce-section-head h2,
.ce-block-head h3 {
  margin: 0;
  font-weight: 700;
}

.ce-section-head p,
.ce-block-head p {
  margin: 4px 0 0;
  color: #6c757d;
  font-size: 14px;
}

.ce-block {
  background: #f8fbff;
  border: 1px solid #c9d8e8;
  border-radius: .5rem;
  box-shadow: 0 3px 12px rgba(15, 39, 66, .1);
  padding: 1.25rem;
  margin-bottom: 18px;
}

.ce-filters {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.ce-filters label {
  display: block;
  color: #6c757d;
  font-weight: 600;
  margin-bottom: .35rem;
  font-size: .8rem;
}

.ce-filters .form-control,
.ce-filters select.form-control {
  min-height: 38px;
  height: 38px;
  line-height: 1.45;
  padding-top: .35rem;
  padding-bottom: .35rem;
}

.ce-filters select.form-control option {
  line-height: 1.45;
}

.ce-table-wrap {
  min-height: 260px;
  max-height: 54vh;
  overflow: auto;
}

.ce-table {
  min-width: 720px;
  margin-bottom: 0;
}

.ce-table td,
.ce-table th {
  vertical-align: middle;
}

.ce-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8f9fa;
  border-bottom: 2px solid #dee2e6 !important;
  color: #29486b;
  font-weight: 700;
  white-space: nowrap;
}

.ce-empty {
  color: #6c757d;
  text-align: center;
  padding: 36px 10px !important;
}

.ce-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 48px;
  color: #6c757d;
  font-size: 13px;
  padding-top: 10px;
}

.ce-pager-actions {
  display: flex;
  gap: 8px;
}

.ce-pager button {
  height: 38px;
  min-width: 38px;
  border: 1px solid #007bff;
  border-radius: .5rem;
  background: #007bff;
  color: #fff;
  padding: 0 12px;
  font-weight: 700;
  cursor: pointer;
}

.ce-pager button:disabled {
  border-color: #ced4da;
  background: #e9ecef;
  color: #6c757d;
  cursor: not-allowed;
}

.ce-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 10px;
  border-radius: 999px;
  background: #e9ecef;
  color: #495057;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.ce-badge.urg-normal {
  background: #e6f4ea;
  color: #1e7e34;
}

.ce-badge.urg-urgente {
  background: #fff3cd;
  color: #856404;
}

.ce-badge.urg-critico {
  background: #f8d7da;
  color: #a71d2a;
}

.ce-badge.status-aberto {
  background: #cfe2ff;
  color: #084298;
}

.ce-badge.status-resolvido {
  background: #e6f4ea;
  color: #1e7e34;
}

.ce-badge.status-cancelado {
  background: #e9ecef;
  color: #495057;
}

.ce-badge.origem-default {
  background: #e9ecef;
  color: #495057;
}

.ce-badge.origem-clinica {
  background: #cfe2ff;
  color: #084298;
}

.ce-badge.status-inativo {
  background: #f1f3f5;
  color: #6c757d;
}

.ce-muted {
  color: #6c757d;
}

/* Botoes de acao em linha de tabela - btn btn-sm padrao Bootstrap, altura
   minima 38px mesmo com btn-sm (AGENTS.md). */
.ce-table .btn-sm {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-weight: 700;
  font-size: .8rem;
  line-height: 1.2;
}

.ce-table .btn-sm img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

/* Drag & drop do Catalogo de Icones (reordenacao dentro da pagina atual,
   substitui o campo numerico "Ordem" do modal - itens ja carregados na
   tela, sem paginacao alternativa). */
.ce-drag-col {
  width: 34px;
}

.ce-drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  font-size: 16px;
  line-height: 1;
  color: #adb5bd;
  cursor: grab;
  user-select: none;
}

.ce-row-draggable {
  cursor: grab;
}

.ce-row-draggable .ce-drag-handle {
  color: #6c757d;
}

.ce-row-draggable:active,
.ce-row-draggable.ce-row-dragging {
  cursor: grabbing;
}

.ce-row-locked .ce-drag-handle {
  color: #dee2e6;
  cursor: default;
}

.ce-row-dragging {
  opacity: .5;
  background: #f1f5ff;
}

.ce-row-drop-target {
  box-shadow: inset 0 2px 0 #007bff, inset 0 -2px 0 #007bff;
  background: #eef5ff;
  border-radius: .5rem;
}

/* Coluna de icone da tabela do Catalogo de Icones - SVG inline pequeno
   (public/js/chat-equipe/icones.js), mesmo tamanho de UI dos demais icones
   de linha (~18-24px). */
.ce-icon-col {
  width: 44px;
}

.ce-icon-cell {
  color: #495057;
}

.ce-icon-cell .ce-icon-svg {
  display: block;
}

/* Seletor visual de icones do modal (grid clicavel) - substitui o campo de
   texto livre antigo (ceCatalogoIcone). Cada tile mostra o SVG do icone +
   rotulo legivel, com estado de selecao via .is-active. Reaproveita a
   paleta ja usada no restante do painel (azul #007bff para selecao/foco,
   #e9ecef/#6c757d para neutro, radius .5rem). */
.ce-icon-search {
  min-height: 38px;
  height: 38px;
  line-height: 1.45;
  margin-bottom: .5rem;
}

.ce-icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: .5rem;
  margin-bottom: .5rem;
  max-height: 320px;
  overflow-y: auto;
  padding-right: .1rem;
}

.ce-icon-grid-empty {
  grid-column: 1 / -1;
  color: #6c757d;
  font-size: .82rem;
  padding: .5rem 0;
  text-align: center;
}

.ce-icon-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  min-height: 76px;
  padding: .5rem .4rem;
  border: 1px solid #dee2e6;
  border-radius: .5rem;
  background: #fff;
  color: #495057;
  cursor: pointer;
  text-align: center;
}

.ce-icon-tile .ce-icon-svg {
  width: 28px;
  height: 28px;
  color: #495057;
}

.ce-icon-tile span {
  font-size: .72rem;
  font-weight: 700;
  line-height: 1.2;
}

.ce-icon-tile:hover {
  border-color: #007bff;
  background: #f2f7ff;
}

.ce-icon-tile.is-active {
  border-color: #007bff;
  background: #eef5ff;
  color: #084298;
  box-shadow: 0 0 0 2px rgba(0, 123, 255, .25);
}

.ce-icon-tile.is-active .ce-icon-svg {
  color: #084298;
}

.ce-icon-tile-outro {
  border-style: dashed;
}

.ce-icon-outro-wrap {
  margin-top: .35rem;
}

.ce-icon-outro-wrap label {
  display: block;
  color: #6c757d;
  font-weight: 600;
  margin-bottom: .35rem;
  font-size: .8rem;
}

.ce-icon-outro-wrap .form-control {
  min-height: 38px;
  height: 38px;
  line-height: 1.45;
}

/* Chat geral / conversas privadas */
.ce-chat-shell {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

@media (min-width: 1100px) {
  .ce-chat-shell {
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  }
}

.ce-chat-messages {
  min-height: 320px;
  max-height: 460px;
  overflow: auto;
  border: 1px solid #c9d8e8;
  border-radius: .5rem;
  padding: 12px;
  background: #eef5fc;
}

.ce-chat-msg {
  border-radius: .5rem;
  background: #fff;
  border: 1px solid #cbdbea;
  padding: 8px 10px;
  margin-bottom: 8px;
}

.ce-chat-msg:last-child {
  margin-bottom: 0;
}

.ce-chat-msg-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  color: #6c757d;
  margin-bottom: 4px;
}

.ce-chat-msg-body {
  font-size: 14px;
  word-break: break-word;
}

.ce-load-more {
  display: block;
  width: 100%;
  min-height: 38px;
  margin-bottom: 10px;
  border: 1px solid #dee2e6;
  border-radius: .5rem;
  background: #fff;
  color: #495057;
  font-weight: 700;
  font-size: .8rem;
  cursor: pointer;
}

.ce-load-more:disabled {
  color: #adb5bd;
  cursor: not-allowed;
}

.ce-conversas-list {
  list-style: none;
  margin: 0;
  padding: 0;
  min-height: 320px;
  max-height: 460px;
  overflow: auto;
}

.ce-conversa-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 8px 10px;
  border: 1px solid #cbdbea;
  border-radius: .5rem;
  margin-bottom: 8px;
  cursor: pointer;
  background: #fff;
}

.ce-conversa-item:hover {
  background: #f2f7ff;
}

.ce-conversa-item.is-active {
  border-color: #007bff;
  background: #eef5ff;
}

/* Lista de Grupos (23.12) - reaproveita .ce-conversa-item, so ajusta o
   alinhamento porque o item tem duas linhas de texto (nome + admin/membros)
   em vez de uma. */
.ce-grupo-item {
  align-items: flex-start;
}

/* Modal de detalhe do grupo (mensagens + membros paginados lado a lado em
   telas largas, CG4 - nunca lista de membros sem paginacao). */
.ce-modal-content-lg {
  width: min(960px, 96%);
}

.ce-grupo-meta {
  margin-bottom: 12px;
}

.ce-grupo-meta p {
  margin: 0 0 4px;
  font-size: .85rem;
}

.ce-grupo-modal-columns {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

@media (min-width: 900px) {
  .ce-grupo-modal-columns {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  }
}

.ce-grupo-modal-columns h6 {
  color: #0f2742;
  font-size: .85rem;
  font-weight: 700;
  margin-bottom: 8px;
}

/* Modal de detalhe (pedido / catalogo) - reaproveita padrao do help-modal
   de public/usuarios/usuario.html: cantos arredondados minimo ~10px */
.ce-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
}

.ce-modal.open {
  display: block;
}

.ce-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .5);
}

.ce-modal-content {
  position: relative;
  width: min(640px, 94%);
  max-height: 88vh;
  overflow: auto;
  margin: 6vh auto;
  background: #fff;
  border-radius: 12px;
  border: 1px solid #d9e5f2;
  box-shadow: 0 20px 44px rgba(15, 39, 66, .2);
}

.ce-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid #c2d4e7;
  background: #eef5fc;
  border-radius: 12px 12px 0 0;
}

.ce-modal-header h5 {
  margin: 0;
  color: #0f2742;
  font-size: .98rem;
  font-weight: 700;
}

.ce-modal-body {
  padding: 14px 16px 16px;
}

.ce-modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  min-width: 38px;
  padding: 0;
  border: 1px solid #cbd5e1;
  border-radius: 50%;
  background: #fff;
  color: #40546b;
  cursor: pointer;
}

.ce-modal-close:hover,
.ce-modal-close:focus {
  border-color: #9fb6cf;
  background: #e7f0f8;
  color: #183b5d;
}

.ce-modal-close img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.ce-form-row {
  margin-bottom: 12px;
}

.ce-form-row label {
  display: block;
  color: #6c757d;
  font-weight: 600;
  margin-bottom: .35rem;
  font-size: .8rem;
}

.ce-form-row .form-control {
  min-height: 38px;
  height: 38px;
  line-height: 1.45;
}

.ce-form-row select.form-control option {
  line-height: 1.45;
}

.ce-form-row textarea.form-control {
  height: auto;
  min-height: 76px;
}

.ce-modal-actions {
  display: flex;
  gap: .4rem;
  justify-content: flex-end;
  margin-top: 14px;
}

.ce-respostas-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ce-respostas-list li {
  border: 1px solid #e9ecef;
  border-radius: .5rem;
  padding: 8px 10px;
  margin-bottom: 8px;
}

@media (max-width: 900px) {
  .ce-section-head,
  .ce-block-head {
    align-items: stretch;
    flex-direction: column;
  }
}
