:root {
  --rosa:       #C2185B;
  --rosa-forte: #8E1248;
  --rosa-claro: #FBD7E6;
  --texto:      #262626;
  --apagado:    #767676;
  --linha:      #ECECEC;
  --fundo:      #FFFFFF;
  --slot:       20px;   /* altura de 15 minutos: 30 min cabem nome + linha de detalhe */
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

body {
  font-family: 'Poppins', system-ui, sans-serif;
  color: var(--texto);
  background: var(--fundo);
  min-height: 100dvh;
}

.oculto { display: none !important; }

/* ---------------------------------------------------------- telas de entrada */

.tela-cheia {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: linear-gradient(160deg, #FFF5F9 0%, #FFFFFF 60%);
}

.cartao {
  width: min(400px, 100%);
  display: grid;
  gap: 14px;
  padding: 28px 24px 24px;
  border: 1px solid var(--linha);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 18px 40px rgba(194, 24, 91, .08);
}

.marca {
  font-family: 'Playfair Display', serif;
  font-size: 28px;
  color: var(--rosa);
  text-align: center;
}

.subtitulo {
  margin-top: -10px;
  text-align: center;
  color: var(--apagado);
  font-size: 14px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.aviso {
  font-size: 13px;
  color: var(--apagado);
  background: #FFF5F9;
  border-radius: 12px;
  padding: 12px 14px;
  line-height: 1.5;
}

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--apagado);
}

input, select {
  font: inherit;
  color: var(--texto);
  padding: 12px 14px;
  border: 1px solid var(--linha);
  border-radius: 12px;
  background: #fff;
  width: 100%;
}

input:focus, select:focus { outline: 2px solid var(--rosa-claro); border-color: var(--rosa); }

.botao {
  font: inherit;
  font-weight: 600;
  padding: 14px;
  border: 0;
  border-radius: 12px;
  background: var(--rosa);
  color: #fff;
  cursor: pointer;
}

.botao:active { background: var(--rosa-forte); }
.botao:disabled { opacity: .5; cursor: default; }

.botao.fantasma { background: transparent; color: var(--apagado); font-weight: 500; }

.erro { color: #C0281B; font-size: 13px; min-height: 18px; text-align: center; }

/* ---------------------------------------------------------- topo da agenda */

.topo {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #fff;
  border-bottom: 1px solid var(--linha);
  padding: env(safe-area-inset-top) 12px 8px;
}

.topo-linha {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  padding-top: 8px;
}

.data { text-align: center; line-height: 1.25; }
.data strong { display: block; font-size: 17px; }
.data span { font-size: 12px; color: var(--apagado); }

.icone {
  font-size: 26px;
  line-height: 1;
  background: none;
  border: 0;
  color: var(--rosa);
  cursor: pointer;
  padding: 6px;
}

.topo-acoes { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.espacador { flex: 1; }

.pilula {
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--rosa-claro);
  background: #FFF5F9;
  color: var(--rosa);
  cursor: pointer;
  width: auto;
}

.pilula.fantasma { background: #fff; border-color: var(--linha); color: var(--apagado); }

/* ---------------------------------------------------------- grade */

.grade {
  display: grid;
  grid-template-columns: 52px repeat(var(--salas, 2), 1fr);
  padding: 0 12px 24px;
  position: relative;
}

.cabecalho-sala {
  position: sticky;
  top: var(--topo, 92px);
  z-index: 4;
  background: #fff;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 0;
  border-bottom: 1px solid var(--linha);
}

.hora {
  grid-column: 1;
  font-size: 11px;
  color: var(--apagado);
  text-align: right;
  padding-right: 8px;
  transform: translateY(-6px);
}

.celula {
  border-top: 1px solid var(--linha);
  cursor: pointer;
}

.celula.meia { border-top-style: dashed; border-top-color: #F6F6F6; }
.celula:active { background: #FFF5F9; }

.bloco {
  margin: 1px 2px;
  padding: 5px 7px;
  border-radius: 8px;
  background: var(--rosa-claro);
  border-left: 3px solid var(--rosa);
  font-size: 11px;
  line-height: 1.3;
  overflow: hidden;
  cursor: pointer;
  z-index: 2;
}

.bloco.meu { background: var(--rosa); border-left-color: var(--rosa-forte); color: #fff; }
.bloco strong { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bloco span { opacity: .8; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.rodape { text-align: center; font-size: 12px; color: var(--apagado); padding: 0 16px 32px; }

/* ---------------------------------------------------------- folha */

.folha {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(0, 0, 0, .35);
  display: grid;
  align-items: end;
}

.folha-conteudo {
  background: #fff;
  border-radius: 20px 20px 0 0;
  padding: 10px 20px calc(24px + env(safe-area-inset-bottom));
  display: grid;
  gap: 12px;
  max-height: 88dvh;
  overflow-y: auto;
}

.puxador {
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: var(--linha);
  margin: 4px auto 8px;
}

.folha-conteudo h2 { font-family: 'Playfair Display', serif; font-size: 22px; }
.folha-conteudo h3 { font-size: 14px; margin-top: 10px; color: var(--apagado); }
.folha-sub { font-size: 13px; color: var(--apagado); margin-top: -8px; }




.girando {
  width: 34px;
  height: 34px;
  border: 3px solid var(--rosa-claro);
  border-top-color: var(--rosa);
  border-radius: 50%;
  animation: girar .8s linear infinite;
}

@keyframes girar { to { transform: rotate(360deg); } }

@media (min-width: 720px) {
  .grade { max-width: 860px; margin: 0 auto; }
  .topo { padding-inline: 24px; }
  .folha { align-items: center; justify-items: center; }
  .folha-conteudo { border-radius: 20px; width: min(420px, 92vw); }
}

/* A barra de ações não pode estourar a largura do celular. */
.topo-acoes { flex-wrap: wrap; }
#escolher-data { max-width: 150px; flex: 0 1 auto; min-width: 0; }

/* ======================================================== v2: app da clínica */

body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
body:has(#tela-app.oculto) { padding-bottom: 0; }

textarea {
  font: inherit;
  color: var(--texto);
  padding: 12px 14px;
  border: 1px solid var(--linha);
  border-radius: 12px;
  width: 100%;
  resize: vertical;
}
textarea:focus { outline: 2px solid var(--rosa-claro); border-color: var(--rosa); }

a.botao, a.pilula { text-decoration: none; text-align: center; display: inline-block; }

.pilha { display: grid; gap: 12px; }
.dupla { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.nota { font-size: 12px; color: var(--apagado); line-height: 1.5; }
.centro { text-align: center; }
.campo { display: grid; gap: 6px; }
.rotulo { font-size: 13px; font-weight: 500; color: var(--apagado); }
.grupo { display: grid; gap: 10px; padding: 12px; background: #FAFAFA; border-radius: 12px; }

.botao.escuro { background: var(--texto); }
.botao.contorno { background: #fff; color: var(--texto); border: 1px solid var(--linha); font-weight: 500; }
.botao.contorno.perigo { color: #C0281B; }
.botao.zap { background: #1FAF55; }
.botao.zap:active { background: #178a43; }

/* ---------------------------------------------------------- blocos da agenda por situação */

.bloco.pendente {
  background: #FFF8E1;
  border-left-color: #E0A100;
  outline: 1px dashed #E0A100;
  outline-offset: -1px;
  color: var(--texto);
}
.bloco.concluido { background: #F1F1F1; border-left-color: #9E9E9E; color: var(--apagado); }
.bloco.concluido.meu { background: #E7E7E7; color: var(--apagado); }

.faixa-pendentes {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  width: 100%;
  margin-top: 8px;
  padding: 9px 12px;
  border: 0;
  border-radius: 10px;
  background: #FFF8E1;
  color: #8A6300;
  cursor: pointer;
  text-align: left;
}

/* ---------------------------------------------------------- abas */

.topo.simples { padding-bottom: 12px; }
.titulo-aba { font-family: 'Playfair Display', serif; font-size: 24px; padding-top: 14px; }
.busca-linha { display: flex; gap: 8px; margin-top: 10px; }
.busca-linha input { flex: 1; min-width: 0; }
.conteudo { padding: 16px 16px 32px; display: grid; gap: 14px; }

.barra {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 10;
  display: flex;
  background: #fff;
  border-top: 1px solid var(--linha);
  padding-bottom: env(safe-area-inset-bottom);
}
.barra button {
  flex: 1;
  font: inherit;
  font-size: 11px;
  font-weight: 500;
  color: var(--apagado);
  background: none;
  border: 0;
  padding: 8px 0 10px;
  display: grid;
  gap: 2px;
  justify-items: center;
  cursor: pointer;
}
.barra button[hidden] { display: none; }
.barra button.ativo { color: var(--rosa); }
.barra-icone { font-size: 19px; line-height: 1.1; }

/* ---------------------------------------------------------- listas */

.lista { list-style: none; display: grid; gap: 8px; padding: 12px 16px 24px; }
.conteudo .lista, .folha .lista, .cartao-ajuste .lista { padding: 0; }

.lista li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: #FAFAFA;
  border-radius: 12px;
  cursor: pointer;
  font-size: 14px;
}
.lista li > div { min-width: 0; }
.lista li strong { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lista li span { display: block; font-size: 12px; color: var(--apagado); }
.lista li em { font-style: normal; font-size: 12px; color: var(--rosa); font-weight: 600; white-space: nowrap; }
.lista li.vazio { justify-content: center; color: var(--apagado); cursor: default; background: none; }
.lista li.feito { opacity: .55; }
.lista.compacta li { padding: 10px 12px; }
.lista li.saida em { color: var(--texto); }

.acoes-linha { display: flex; gap: 6px; flex-shrink: 0; }

.apagar {
  border: 0; background: none; color: var(--apagado);
  font-size: 20px; line-height: 1; padding: 2px 4px; cursor: pointer;
}

.sugestoes { list-style: none; display: grid; gap: 4px; }
.sugestoes li {
  display: flex; justify-content: space-between; gap: 8px;
  padding: 10px 12px; border-radius: 10px; background: #FFF5F9; cursor: pointer; font-size: 14px;
}
.sugestoes li span { color: var(--apagado); font-size: 12px; }

.escolhida {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: 12px; background: #FFF5F9; border: 1px solid var(--rosa-claro);
}
.escolhida strong { display: block; }
.escolhida span { font-size: 12px; color: var(--apagado); }

/* ---------------------------------------------------------- ficha do agendamento */

.ficha { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; font-size: 14px; }
.ficha dt { color: var(--apagado); font-size: 12px; padding-top: 2px; }
.ficha dd { margin: 0; }

.selo {
  display: inline-block; font-size: 11px; font-weight: 600;
  padding: 3px 9px; border-radius: 999px; background: var(--rosa-claro); color: var(--rosa-forte);
  white-space: nowrap;
}
.selo.pendente { background: #FFF1C2; color: #8A6300; }
.selo.concluido { background: #E3F4E8; color: #1D7A3E; }
.selo.faltou, .selo.cancelado { background: #F1F1F1; color: var(--apagado); }

details summary {
  cursor: pointer; font-size: 14px; font-weight: 600; color: var(--rosa);
  padding: 10px 0; list-style: none;
}
details summary::-webkit-details-marker { display: none; }
.concluir { border: 1px solid var(--linha); border-radius: 12px; padding: 2px 14px; }
.concluir[open] { padding-bottom: 14px; }

/* ---------------------------------------------------------- caixa */

.placar { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.placar-item { padding: 12px 10px; border-radius: 14px; background: #FAFAFA; display: grid; gap: 2px; }
.placar-item span { font-size: 11px; color: var(--apagado); text-transform: uppercase; letter-spacing: .04em; }
.placar-item strong { font-size: 15px; font-weight: 700; overflow-wrap: anywhere; }
.placar-item.entrada strong { color: #1D7A3E; }
.placar-item.saldo { background: #FFF5F9; }
.placar-item.saldo strong { color: var(--rosa); }
.placar-item.saldo.negativo strong { color: #C0281B; }

/* ---------------------------------------------------------- ajustes */

.cartao-ajuste {
  border: 1px solid var(--linha); border-radius: 16px; padding: 16px;
  display: grid; gap: 10px;
}
.cartao-ajuste h3 { font-size: 15px; }
.link-copiar {
  display: flex; align-items: center; gap: 8px;
  background: #FFF5F9; border-radius: 10px; padding: 8px 8px 8px 12px;
}
.link-copiar code { flex: 1; min-width: 0; font-size: 12px; overflow-wrap: anywhere; }
.linha-check { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--texto); }
.linha-check input { width: 20px; height: 20px; accent-color: var(--rosa); }

@media (min-width: 720px) {
  .aba .topo.simples, .conteudo, #lista-clientes { max-width: 860px; margin-inline: auto; }
  .folha-conteudo { width: min(460px, 92vw); }
}

/* ---------------------------------------------------------- bloqueio (folga, férias, manutenção) */
.bloco.bloqueio {
  background: repeating-linear-gradient(135deg, #F3F3F3 0 8px, #E9E9E9 8px 16px);
  border-left-color: #7A7A7A;
  color: #555;
}
.selo.bloqueio { background: #ECECEC; color: #555; }

/* Com Bloquear e Lembretes, a barra aperta no celular: pílulas mais justas pra caber numa linha. */
@media (max-width: 440px) {
  .topo-acoes { gap: 5px; }
  .topo-acoes .pilula { padding: 7px 10px; font-size: 12.5px; }
  #escolher-data { max-width: 112px; padding-inline: 8px; font-size: 12px; }
}

/* ---- fotos de serviço e joia (Ajustes) */
.foto-campo { display: grid; gap: 8px; justify-items: start; }
.foto-previa { width: 88px; height: 88px; border-radius: 12px; object-fit: cover; border: 1px solid var(--linha); }

/* ---- variações da joia */
.variacao-linha { display: grid; gap: 8px; padding: 10px; border: 1px dashed var(--linha); border-radius: 12px; }
.tripla { display: grid; grid-template-columns: 1fr 1fr 76px; gap: 8px; }

/* ---- itens do atendimento */
.itens:empty { display: none; }
.item-linha { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.item-linha span:first-child { flex: 1; }
.item-linha em { font-style: normal; font-weight: 600; white-space: nowrap; }
.item-linha.total { border-top: 1px solid var(--linha); padding-top: 8px; font-weight: 600; }
.item-linha .pilula { padding: 2px 9px; }

.pilula.ativa { background: var(--rosa); color: #fff; border-color: var(--rosa); }
