/* Estilos do módulo agenda (usa as variáveis de app.css).
   Cores e posições dos blocos chegam por el.style no JavaScript: a CSP proíbe style="" no HTML. */

/* ---------------------------------------------------------- barra de navegação */
.ag-barra { padding: 14px 16px; margin-bottom: 16px; display: flex; flex-direction: column; gap: 12px; }
.ag-barra-linha { display: flex; align-items: center; gap: 10px 16px; flex-wrap: wrap; }
.ag-nav { display: flex; align-items: center; gap: 6px; }
.ag-barra .ag-data { width: auto; min-height: 44px; padding: 8px 12px; }
.ag-periodo { font-weight: 650; font-size: 16px; flex: 1; min-width: 150px; }
.ag-segmentos { display: inline-flex; flex-wrap: wrap; background: var(--fundo-2); border-radius: 999px; padding: 3px; gap: 2px; }
.ag-segmentos button {
  border: 0; background: none; border-radius: 999px; padding: 8px 16px; min-height: 40px;
  font: inherit; font-weight: 600; font-size: 14px; color: var(--texto-2); cursor: pointer;
}
.ag-segmentos button.ativo { background: #fff; color: var(--texto); box-shadow: var(--sombra); }
.ag-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ag-chip {
  display: inline-flex; align-items: center; gap: 7px; border: 0; border-radius: 999px; background: var(--fundo-2);
  color: var(--texto-2); padding: 8px 14px; min-height: 40px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
.ag-chip .ponto-cor, .ag-col-titulo .ponto-cor { margin: 0; flex: none; background: var(--texto-3); }
.ag-chip.ativo { background: var(--ouro-suave); color: var(--ouro-texto); }
.ag-chip:not(.ativo) .ponto-cor { opacity: .4; }
.ag-prof-unico { display: flex; flex-direction: column; gap: 4px; max-width: 380px; }

/* ---------------------------------------------------------- calendário (dia e semana no computador) */
.ag-cal { overflow: hidden; }
.ag-rolagem { overflow: auto; max-height: calc(100vh - 300px); min-height: 380px; border-radius: var(--raio); }
.ag-grade { --ag-linha: 30px; display: grid; min-width: 100%; }
.ag-canto, .ag-col-titulo { position: sticky; top: 0; z-index: 4; background: #fff; box-shadow: inset 0 -1px 0 var(--linha); min-height: 48px; }
.ag-canto { left: 0; z-index: 6; }
.ag-col-titulo { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 6px 10px; font-weight: 650; font-size: 14px; min-width: 0; }
.ag-col-nome { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag-col-dia { border: 0; background: none; font: inherit; color: inherit; cursor: pointer; padding: 6px 12px; border-radius: 999px; min-height: 36px; }
.ag-col-dia span { color: var(--texto-2); font-weight: 500; }
.ag-col-dia:hover { background: var(--fundo-2); }
.ag-col-titulo.hoje .ag-col-dia { background: var(--ouro-suave); color: var(--ouro-texto); }
.ag-horas { position: sticky; left: 0; z-index: 3; background: #fff; box-shadow: inset -1px 0 0 var(--linha); }
.ag-hora { height: var(--ag-linha); font-size: 11px; color: var(--texto-3); text-align: right; padding: 3px 8px 0 0; line-height: 1; font-variant-numeric: tabular-nums; }
.ag-hora.cheia { color: var(--texto-2); font-weight: 650; }
.ag-coluna { position: relative; box-shadow: inset -1px 0 0 var(--linha); min-width: 0; }
.ag-coluna.hoje { background: #fffdf7; }
.ag-slot { display: block; width: 100%; height: var(--ag-linha); border: 0; margin: 0; padding: 0; background: transparent; box-shadow: inset 0 -1px 0 #f5f3ee; }
.ag-slot.cheia { box-shadow: inset 0 1px 0 var(--linha), inset 0 -1px 0 #f5f3ee; }
button.ag-slot { cursor: pointer; }
button.ag-slot:hover { background-color: var(--ouro-suave); }
button.ag-slot:focus-visible { outline: 2px solid var(--ouro); outline-offset: -2px; }
.ag-slot.fora, .ag-livre.fora { background-image: repeating-linear-gradient(135deg, #f4f3ef 0 6px, #fbfaf8 6px 12px); }
.ag-bloqueio {
  position: absolute; left: 0; right: 0; z-index: 1; overflow: hidden; pointer-events: none; padding: 6px 8px;
  background: repeating-linear-gradient(135deg, #eeece6 0 8px, #f6f5f1 8px 16px); box-shadow: inset 3px 0 0 var(--texto-3);
  color: var(--texto-2); font-size: 12px; font-weight: 600;
}
.ag-bloqueio span { display: flex; align-items: center; gap: 6px; }
.ag-bloqueio svg { width: 14px; height: 14px; }
.ag-bloco {
  position: absolute; z-index: 2; box-sizing: border-box; min-height: 22px; padding: 4px 6px 4px 8px; overflow: hidden;
  display: flex; flex-direction: column; gap: 2px; border-radius: 8px; border: 1px solid #fff; border-left: 4px solid var(--ouro);
  background: var(--ouro-suave); color: var(--texto); text-decoration: none; font-size: 12.5px; line-height: 1.25;
}
.ag-bloco:hover, .ag-bloco:focus-visible { z-index: 5; box-shadow: var(--sombra-forte); outline: none; }
.ag-bloco-linha { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag-bloco-proc { color: var(--texto-2); }
.ag-bloco-selos { display: flex; gap: 4px; flex-wrap: wrap; }
.ag-bloco .selo { font-size: 10.5px; padding: 0 7px; }
.ag-bloco.curto { flex-direction: row; align-items: center; padding-top: 1px; padding-bottom: 1px; }
.ag-bloco.curto .ag-bloco-proc, .ag-bloco.curto .ag-bloco-selos { display: none; }
.ag-bloco.st-faltou { opacity: .55; }
.ag-bloco.st-faltou b { text-decoration: line-through; }
.ag-bloco.st-atendido { opacity: .72; }
.ag-bloco.st-chegou, .ag-bloco.st-em_atendimento { box-shadow: 0 0 0 2px var(--ouro); }
.ag-bloco.st-cancelado, .ag-bloco.st-remarcado { opacity: .4; text-decoration: line-through; }
.ag-agora { position: absolute; left: 0; right: 0; height: 2px; background: var(--vermelho); z-index: 4; pointer-events: none; }
.ag-agora::before { content: ''; position: absolute; left: -4px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--vermelho); }

/* ---------------------------------------------------------- listas (celular, hoje, fila) */
.ag-lista-dia .item-lista { min-height: 58px; }
button.item-lista { border: 0; background: none; width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.ag-hora-lista { width: 52px; flex: none; display: flex; flex-direction: column; font-variant-numeric: tabular-nums; font-size: 14.5px; }
.ag-hora-lista span { font-size: 12px; color: var(--texto-3); }
.ag-faixa-cor { width: 4px; align-self: stretch; border-radius: 4px; background: var(--ouro); flex: none; }
.ag-selos { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; flex: none; max-width: 45%; }
.ag-selos .selo { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.ag-livre { color: var(--texto-2); }
.ag-lista-dia .ag-livre { min-height: 48px; }
.ag-livre.bloqueado { background: #f3f1ec; }
.ag-livre > svg { color: var(--ouro-texto); }
.ag-item.st-faltou, .ag-item.st-cancelado, .ag-item.st-remarcado,
.ag-item-hoje.st-faltou, .ag-item-hoje.st-cancelado, .ag-item-hoje.st-remarcado { opacity: .6; }

.ag-indicadores { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.ag-item-hoje { flex-wrap: wrap; gap: 10px 14px; }
.ag-item-hoje-abrir { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0; text-decoration: none; color: inherit; }
.ag-item-hoje-abrir .principal { flex: 1; min-width: 0; }
.ag-rapidos { display: flex; gap: 8px; flex-wrap: wrap; }
.ag-rapidos .botao { padding: 8px 16px; }

.ag-item-fila { flex-wrap: wrap; align-items: flex-start; }
.ag-item-fila .detalhe { white-space: normal; }
.ag-fila-acoes { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }

/* ---------------------------------------------------------- mês */
.ag-mes { padding: 12px; }
.ag-mes-grade { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.ag-mes-cab { text-align: center; font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--texto-3); font-weight: 600; padding: 4px 0; }
.ag-mes-dia {
  border: 0; background: var(--fundo-2); border-radius: var(--raio-p); min-height: 88px; padding: 8px; min-width: 0;
  display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 6px;
  font: inherit; color: inherit; cursor: pointer; text-align: left;
}
.ag-mes-dia:hover { background: var(--ouro-suave); }
.ag-mes-dia.outro-mes { opacity: .45; }
.ag-mes-dia.hoje { box-shadow: inset 0 0 0 2px var(--ouro); }
.ag-mes-num { font-weight: 650; }
.ag-mes-qtd { background: #fff; color: var(--ouro-texto); border-radius: 999px; padding: 2px 9px; font-size: 12px; font-weight: 650; white-space: nowrap; box-shadow: var(--sombra); }

/* ---------------------------------------------------------- janelas: agendamento, detalhes */
.ag-form input[type=time], .ag-intervalo input[type=time] {
  width: 100%; border: 1px solid #e3dfd5; background: #fff; border-radius: var(--raio-p);
  padding: 11px 14px; font-size: 16px; min-height: 46px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.ag-form input[type=time]:focus, .ag-intervalo input[type=time]:focus { border-color: var(--ouro); box-shadow: 0 0 0 4px rgba(196, 154, 34, .15); }
.ag-paciente-escolhido { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--fundo-2); border-radius: var(--raio-p); }
.ag-paciente-escolhido .principal { flex: 1; min-width: 0; }
.ag-paciente-escolhido .titulo { font-weight: 650; display: block; }
.ag-paciente-escolhido .detalhe { font-size: 13px; color: var(--texto-2); }
.ag-paciente-escolhido .avatar, .ag-det-topo .avatar { background: var(--ouro-suave); color: var(--ouro-texto); }
.ag-repetir > summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; color: var(--ouro-texto); }

.ag-det-topo { display: flex; align-items: center; gap: 12px; }
.ag-det-topo .avatar { width: 46px; height: 46px; }
.ag-det-topo .principal { flex: 1; min-width: 0; }
.ag-det-nome { font-weight: 650; font-size: 17px; }
.ag-det { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 6px 12px; margin: 0; font-size: 14px; }
.ag-det dt { color: var(--texto-2); }
.ag-det dd { margin: 0; }
.ag-acoes-status { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px; background: var(--fundo-2); border-radius: var(--raio-p); }
.ag-confirmar { display: flex; gap: 6px; flex-wrap: wrap; }
.ag-confirmar select { width: auto; }
.ag-link { justify-content: flex-start; padding-left: 0; align-self: flex-start; }
.ag-historico > summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--texto-2); min-height: 40px; display: flex; align-items: center; }
.ag-historico ul { margin: 4px 0 0; padding-left: 18px; font-size: 13.5px; color: var(--texto-2); display: flex; flex-direction: column; gap: 4px; }
.ag-hist-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; min-height: 44px; text-decoration: none; color: inherit; font-size: 13.5px; box-shadow: inset 0 -1px 0 var(--linha); }
.ag-hist-item .principal { flex: 1; min-width: 0; color: var(--texto-2); }

/* ---------------------------------------------------------- sala cirúrgica */
.ag-linha-clique { cursor: pointer; }
.ag-linha-clique:hover td { background: var(--fundo-2); }

/* ---------------------------------------------------------- bloqueios e horários */
.ag-duas-colunas { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.ag-duas-colunas > .cartao + .cartao { margin-top: 0; }
.ag-bloq-topo { padding-bottom: 8px; gap: 8px; }
.ag-bloq-vazio { padding-top: 0; }
.ag-icone-redondo { width: 38px; height: 38px; border-radius: 50%; background: var(--fundo-2); display: grid; place-items: center; color: var(--texto-2); flex: none; }
.ag-icone-redondo svg { width: 18px; height: 18px; }
.ag-semana-horarios { display: flex; flex-direction: column; }
.ag-dia-horario { display: flex; gap: 12px; padding: 10px 0; box-shadow: inset 0 -1px 0 var(--linha); align-items: flex-start; }
.ag-dia-nome { width: 76px; flex: none; font-weight: 600; padding-top: 12px; }
.ag-intervalos { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; align-items: flex-start; }
.ag-intervalo { display: flex; align-items: center; gap: 6px; }
.ag-intervalo input[type=time] { width: 120px; padding: 8px 10px; }
.ag-nao-atende { padding-top: 12px; }
.ag-mais-intervalo { min-height: 40px; padding: 6px 8px; }

/* ---------------------------------------------------------- celular (375 e 320): sem rolagem lateral */
@media screen and (max-width: 899px) {
  .ag-barra { padding: 12px; }
  .ag-nav { flex-wrap: wrap; flex: 1 1 100%; }
  .ag-barra .ag-data { flex: 1 1 130px; min-width: 0; }
  .ag-periodo { flex: 1 1 100%; min-width: 0; font-size: 15px; }
  .ag-prof-unico { max-width: none; }
  .ag-indicadores { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .ag-indicadores .indicador { padding: 12px; }
  .ag-indicadores .valor { font-size: 22px; }
  .ag-indicadores .rotulo { font-size: 12px; }
  .ag-item-hoje-abrir { gap: 10px; }
  .ag-rapidos, .ag-fila-acoes { width: 100%; justify-content: flex-end; }
  .ag-rapidos .botao { flex: 1; min-height: 44px; }
  .ag-mes { padding: 8px; }
  .ag-mes-grade { gap: 4px; }
  .ag-mes-dia { min-height: 56px; padding: 6px; }
  .ag-mes-qtd { padding: 1px 6px; font-size: 11.5px; }
  .ag-so-pc { display: none; }
  .ag-det { grid-template-columns: 92px minmax(0, 1fr); }
  .ag-duas-colunas { grid-template-columns: 1fr; }
  .ag-dia-horario { flex-direction: column; gap: 6px; }
  .ag-dia-nome { width: auto; padding-top: 0; }
  .ag-intervalos { width: 100%; }
  .ag-intervalo { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) 44px; width: 100%; }
  .ag-intervalo input[type=time] { width: 100%; min-width: 0; padding: 8px; }
  .ag-nao-atende { padding-top: 0; }
}

/* ---------------------------------------------------------- impressão do mapa cirúrgico (fundo branco, contornos finos) */
@media print {
  .ag-impressao h3 { font-size: 12pt; margin: 16px 0 6px; }
  .ag-impressao p { margin: 0 0 8px; }
  .ag-impresso-em { margin-top: 18px !important; font-size: 9pt; color: #444; }
}
