body { background: #f4f5f7; }

.kanban-row { min-height: calc(100vh - 130px); }
.kanban-col {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
  border-top: 6px solid #ccc;
  height: calc(100vh - 130px);
  display: flex;
  flex-direction: column;
}
.kanban-vermelha { border-top-color: #dc3545; }
.kanban-amarela  { border-top-color: #ffc107; }
.kanban-verde    { border-top-color: #198754; }

.kanban-header { padding: .65rem .9rem; border-bottom: 1px solid #eee; }
.kanban-body   { padding: .65rem; overflow-y: auto; flex: 1; }

.dot {
  display: inline-block;
  width: .7em; height: .7em;
  border-radius: 50%;
  margin-right: .25em;
  vertical-align: middle;
}
.dot-vermelha { background: #dc3545; }
.dot-amarela  { background: #ffc107; }
.dot-verde    { background: #198754; }

.card-paciente {
  text-decoration: none;
  color: inherit;
  transition: transform .08s ease, box-shadow .08s ease;
  border-left: 4px solid transparent;
}
.card-paciente:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0,0,0,.12);
  color: inherit;
}
.card-paciente.sla-warning  { border-left-color: #fd7e14; background: #fff8ef; }
.card-paciente.sla-exceeded {
  border-left-color: #dc3545;
  background: #ffecec;
  animation: pulse 1.6s ease-in-out infinite;
}
.card-paciente.has-codigo { border-left-color: #6f42c1; }

.tempo, .tempo-desde { font-variant-numeric: tabular-nums; }
.status-badge { font-size: .65rem; }

.codigo-badge { animation: blink 1.6s ease-in-out infinite; }

.pendencias-list {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem;
  align-items: center;
}
.pendencia-pill {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .1rem .4rem;
  border-radius: 999px;
  background: #e3f4ff;
  color: #055160;
  font-size: .72rem;
  line-height: 1.2;
  max-width: 100%;
}
.pendencia-pill.exame-lab    { background: #ffe3e3; color: #8a1c1c; }
.pendencia-pill.exame-imagem { background: #fff0d6; color: #6b3b00; }
.pendencia-pill.parecer       { background: #e7e6ff; color: #2d1e9e; }
.pendencia-pill .pend-tipo { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 12em; }
.pendencia-pill .pend-tempo { font-weight: 600; }
.pendencia-pill.pend-warn   { background: #ffe5b3; color: #6e4500; }
.pendencia-pill.pend-late   { background: #ffd6d6; color: #8a1c1c; animation: blink 1.6s ease-in-out infinite; }

.codigo-ativo {
  border-left: 6px solid currentColor;
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220,53,69,.0); }
  50%      { box-shadow: 0 0 0 6px rgba(220,53,69,.18); }
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: .55; }
}

details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details[open] > summary { margin-bottom: .25rem; }

/* ===== Avatar com iniciais ===== */
.avatar-paciente {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem; height: 2rem;
  border-radius: 50%;
  color: #fff;
  font-weight: 700;
  font-size: .75rem;
  flex-shrink: 0;
  letter-spacing: -.5px;
}

/* ===== Densidade ===== */
.density-compact .density-hide-compact { display: none !important; }
.density-compact .card-paciente .card-body { padding: .35rem .5rem !important; }
.density-compact .avatar-paciente { width: 1.5rem; height: 1.5rem; font-size: .65rem; }
.density-compact .card-paciente strong { font-size: .85rem; }

/* ===== Tabs mobile ===== */
@media (max-width: 767px) {
  .mobile-show-vermelha .col-mobile-amarela,
  .mobile-show-vermelha .col-mobile-verde,
  .mobile-show-amarela  .col-mobile-vermelha,
  .mobile-show-amarela  .col-mobile-verde,
  .mobile-show-verde    .col-mobile-vermelha,
  .mobile-show-verde    .col-mobile-amarela { display: none !important; }
}

/* ===== Drag-and-drop ===== */
.kanban-col.drag-over {
  outline: 3px dashed #0d6efd;
  outline-offset: -3px;
  background: #eef6ff;
}
.card-paciente { cursor: grab; }
.card-paciente:active { cursor: grabbing; }

/* ===== Edição rápida de hora ===== */
.hora-edit .hora-form { background: #fff; padding: .3rem; border: 1px solid #dee2e6; border-radius: .375rem; }
.hora-edit .editor-hora { font-variant-numeric: tabular-nums; }

/* ===== Detalhe do paciente: sticky header, tabs, linhas compactas ===== */
.avatar-paciente.avatar-lg { width: 3rem; height: 3rem; font-size: 1.1rem; }

.paciente-header { position: sticky; top: 0; z-index: 5; padding: 0 .25rem; }
body.embed-mode .paciente-header { top: 0; }

.hd-pill { font-size: .8rem; padding: .25rem .5rem; display: inline-flex; align-items: center; gap: .25rem; }
.btn-pill-close {
  background: transparent; border: 0; color: #888; padding: 0 .2rem;
  font-size: .9rem; line-height: 1; cursor: pointer;
}
.btn-pill-close:hover { color: #dc3545; }

.codigo-bar { font-size: .85rem; animation: blink 1.6s ease-in-out infinite; }

.nav-fluxista .nav-link {
  padding: .35rem .65rem; font-size: .85rem; color: #495057;
}
.nav-fluxista .nav-link.active { color: #0d6efd; font-weight: 600; }

/* Lista compacta de exames/pareceres/anotações */
.list-compact { list-style: none; padding: 0; margin: 0; }
.item-compact {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto auto auto;
  gap: .5rem;
  align-items: center;
  padding: .35rem .5rem;
  border-bottom: 1px solid #eee;
}
.item-compact .item-icon { text-align: center; }
.item-compact .item-tipo { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-compact .item-hora { white-space: nowrap; }
.item-compact .item-detail { grid-column: 1 / -1; color: #555; margin-top: .15rem; }
.item-compact.item-pend { background: #fffbea; }

.add-form { padding: .35rem .5rem; background: #f8f9fa; border-radius: .375rem; }

/* Atalhos da row no header */
.atalhos-row { gap: .25rem !important; }
.atalhos-row .btn { white-space: nowrap; }

/* Density no detalhe */
.density-compact .nav-fluxista .nav-link { font-size: .75rem; padding: .25rem .4rem; }
.density-compact .item-compact { padding: .15rem .5rem; font-size: .82rem; }
.density-compact .item-compact .item-hora { display: none; }
.density-compact .hd-pill { font-size: .7rem; padding: .1rem .35rem; }
.density-compact .atalhos-row .btn { font-size: .75rem; padding: .15rem .4rem; }

/* Painel split (master-detail) */
.painel-split { height: calc(100vh - 80px); margin: 0; }
.painel-lista { height: 100%; overflow: hidden; padding-right: 0; }
.painel-lista .card { display: flex; flex-direction: column; }
.painel-lista-pacientes { overflow-y: auto; flex: 1; padding: 0; margin: 0; list-style: none; }
.painel-lista-pacientes > li { list-style: none; }
.paciente-row { transition: background .1s; }
.paciente-row:hover { background: #f0f4f8; }
.paciente-row.row-active { background: #cfe2ff; }
.paciente-row.row-active strong { color: #0d6efd; }
.painel-detalhe { height: 100%; padding-left: .5rem; }
.painel-iframe { width: 100%; height: 100%; border: 1px solid #dee2e6; border-radius: .5rem; background: #fff; }

/* embed mode: tira padding extra do container quando dentro do iframe */
body.embed-mode { background: #fff; }
body.embed-mode main { padding-top: .5rem !important; }

@media (max-width: 767px) {
  .painel-split { height: auto; }
  .painel-lista, .painel-detalhe { height: auto; }
  .painel-iframe { height: 70vh; }
}

@media (max-width: 767px) {
  .kanban-col { height: auto; }
  .kanban-row { min-height: 0; }
}
