/* Portal de Terapias — página standalone (public/portal-terapia.html).
   Só o layout específico do portal; cor/raio/espaço vêm dos tokens de
   design-system.css (var(--...)), nunca valor fixo. */

/* Trava rolagem lateral da página inteira — mesmo padrão do resto do
   Gestor Online (style.css: `html{overflow-x:hidden}`), incluindo o
   módulo PAT. Sem isso, qualquer elemento que escape por alguns pixels
   (ex.: achado 39 da auditoria de UX) faz a página toda arrastar pros
   lados; com isso, o excesso fica sempre cortado, e o vazamento vira só
   um detalhe de layout a corrigir, não uma barra de rolagem confusa. */
html, body { margin: 0; height: 100%; background: var(--bg); overflow-x: hidden; max-width: 100%; }
html, body {
  /* Mesmo travamento de gesto do resto do Gestor Online (style.css) —
     pedido da cliente: "no PAT a tela é fixa, aqui dá pra dar zoom".
     touch-action:pan-y permite só arrastar verticalmente, bloqueando o
     pinch-zoom; overscroll-behavior:none tira o bounce/pull-to-refresh
     nas bordas. Zoom por acessibilidade (leitura de tela ampliada) segue
     possível via configuração do próprio navegador/SO, só o gesto de
     pinça dentro da página é que fica bloqueado — mesma escolha já feita
     pro app principal. */
  overscroll-behavior: none;
  touch-action: pan-y;
}
body { font-family: 'Inter', sans-serif; }
.tp-shell { max-width: 100vw; }

.tp-shell { min-height: 100vh; display: flex; flex-direction: column; }

.tp-header {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 24px; background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 5; flex-shrink: 0;
  box-shadow: 0 1px 0 rgba(0,0,0,.02), 0 4px 16px -12px rgba(0,0,0,.35);
}
.tp-brand { display: flex; align-items: center; gap: 12px; }
.tp-brand-ic {
  width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
  background: #fff; box-shadow: 0 0 0 1px var(--border-strong), 0 6px 18px -6px var(--primary-glow);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.tp-brand-ic img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.tp-brand-title { font-family: var(--font-display); font-size: 15.5px; font-weight: 800; color: var(--text); letter-spacing: -.01em; }
.tp-brand-sub { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.tp-header-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.tp-header-user-block { display: flex; align-items: center; gap: 10px; }
.tp-header-user-name { font-size: 13px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
.tp-header-user-role { font-size: 10.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; text-align: right; }
#tp-tema-btn { flex-shrink: 0; padding: 0; width: 34px; display: flex; align-items: center; justify-content: center; }

.tp-wrap { flex: 1; display: flex; flex-direction: column; width: 100%; max-width: 1100px; margin: 0 auto; padding: 32px 32px 48px; position: relative; }
#tp-mount { flex: 1; display: flex; flex-direction: column; width: 100%; }

/* Login */
.tp-shell:has(.tp-login-shell) { position: relative; overflow: hidden; }
.tp-shell:has(.tp-login-shell)::before,
.tp-shell:has(.tp-login-shell)::after {
  content: ''; position: absolute; border-radius: 50%; pointer-events: none; z-index: 0; filter: blur(64px);
}
.tp-shell:has(.tp-login-shell)::before {
  width: 520px; height: 520px; top: -220px; right: -160px;
  background: radial-gradient(circle, var(--primary-glow), transparent 70%);
}
.tp-shell:has(.tp-login-shell)::after {
  width: 420px; height: 420px; bottom: -200px; left: -140px;
  background: radial-gradient(circle, var(--accent-soft), transparent 70%);
}
.tp-login-shell {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 28px; width: 100%; padding: 24px 0; position: relative; z-index: 1;
  animation: tp-fade-in .5s ease both;
}
@keyframes tp-fade-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.tp-login-logo-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.tp-login-brand-ic {
  width: 56px; height: 56px; border-radius: 16px; background: #fff;
  box-shadow: 0 0 0 1px var(--border-strong), 0 14px 32px -12px var(--primary-glow);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.tp-login-brand-ic img { width: 100%; height: 100%; object-fit: contain; padding: 6px; }
.tp-login-brand-title { font-family: var(--font-display); font-size: 19px; font-weight: 800; color: var(--text); letter-spacing: -.01em; }
.tp-login-brand-sub { font-size: 12px; color: var(--text-muted); }
.tp-login-card {
  width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 30px 28px; display: flex; flex-direction: column; gap: 16px;
  box-shadow: 0 24px 56px -24px rgba(0,0,0,.5), 0 2px 0 rgba(255,255,255,.02) inset;
  position: relative; overflow: hidden;
}
.tp-login-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}
.tp-login-title-row { display: flex; align-items: center; gap: 12px; }
.tp-login-title-ic {
  width: 38px; height: 38px; border-radius: var(--radius-sm); flex-shrink: 0;
  background: var(--primary-soft); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
}
.tp-login-title { font-size: 16.5px; font-weight: 700; color: var(--text); }
.tp-login-subtitle { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }
.tp-field-label { display: block; margin-bottom: 6px; font-size: 10px; color: var(--text-muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.tp-field-group { position: relative; display: flex; align-items: center; }
.tp-field-ic { position: absolute; left: 12px; color: var(--text-muted); display: flex; pointer-events: none; transition: color .15s ease; }
.tp-field-group input.form-input { width: 100%; height: 42px; padding-left: 38px; font-size: 13.5px; }
.tp-field-group:focus-within .tp-field-ic { color: var(--primary); }
.tp-login-btn { width: 100%; height: 42px; font-size: 13.5px; font-weight: 700; gap: 8px; }
.tp-login-footer { text-align: center; font-size: 11px; color: var(--text-muted); position: relative; z-index: 1; }
@keyframes tp-shake { 10%, 90% { transform: translateX(-1px); } 20%, 80% { transform: translateX(2px); } 30%, 50%, 70% { transform: translateX(-4px); } 40%, 60% { transform: translateX(4px); } }
.tp-shake { animation: tp-shake .4s ease; }

/* Abas por papel */
.tp-tabs {
  display: flex; gap: 4px; margin-bottom: 22px; border-bottom: 1px solid var(--border);
  /* Rolagem horizontal em vez de forçar a página inteira a alargar — em
     320px "Colaborador + Terapeuta + Supervisor/Admin" não cabem lado a
     lado sem vazar (achado real do teste de responsividade mobile). */
  overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.tp-tabs::-webkit-scrollbar { display: none; }
.tp-tab-btn { padding: 10px 16px; font-size: 12.5px; font-weight: 700; color: var(--text-muted); background: none; border: none; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap; flex-shrink: 0; transition: color .15s ease; }
.tp-tab-btn:hover { color: var(--text); }
.tp-tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

.tp-welcome { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.tp-welcome-title { font-family: var(--font-display); font-size: 23px; font-weight: 800; color: var(--text); letter-spacing: -.01em; }
.tp-welcome-sub { font-size: 12.5px; color: var(--text-muted); margin-top: 4px; }

.tp-section-title { font-family: var(--font-display); font-size: 14.5px; font-weight: 700; color: var(--text); margin: 28px 0 12px; display: flex; align-items: center; gap: 8px; }
.tp-section-title:first-child { margin-top: 0; }
.tp-section-title .tp-section-ic { color: var(--primary); display: flex; }

/* Cards de horário/agendamento */
.tp-grid { display: flex; flex-wrap: wrap; gap: 14px; }
.tp-slot {
  flex: 1 1 220px; max-width: 300px; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px 18px; display: flex; flex-direction: column; gap: 8px;
  position: relative; overflow: hidden; transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.tp-slot::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: linear-gradient(180deg, var(--primary), var(--accent)); }
.tp-slot:hover { transform: translateY(-2px); border-color: var(--border-strong); box-shadow: 0 16px 32px -20px rgba(0,0,0,.5); }
.tp-slot-data { font-size: 10.5px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.tp-slot-hora { font-family: var(--font-display); font-size: 22px; font-weight: 800; color: var(--text); }
.tp-slot-meta { font-size: 12px; color: var(--text-muted); }
.tp-slot-actions { margin-top: auto; padding-top: 4px; }

/* Agendamento estilo calendário: chips de data (rolagem horizontal) +
 * grade de horários do dia selecionado, em vez de listar todos os slots
 * de todas as datas soltos juntos. */
.tp-cal-chips {
  display: flex; gap: 8px; overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: none; padding-bottom: 4px; margin-bottom: 4px;
}
.tp-cal-chips::-webkit-scrollbar { display: none; }
.tp-cal-chip {
  flex: 0 0 auto; width: 56px; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 10px 6px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--card);
  cursor: pointer; position: relative; transition: all .15s ease;
}
.tp-cal-chip:hover { border-color: var(--border-strong); }
.tp-cal-chip.active { background: var(--primary); border-color: var(--primary); }
.tp-cal-chip-dow { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted); }
.tp-cal-chip.active .tp-cal-chip-dow { color: rgba(255,255,255,.85); }
.tp-cal-chip-day { font-family: var(--font-display); font-size: 18px; font-weight: 800; color: var(--text); }
.tp-cal-chip.active .tp-cal-chip-day { color: #fff; }
.tp-cal-chip-count {
  font-size: 9px; font-weight: 700; color: var(--primary); background: var(--primary-soft);
  border-radius: 999px; padding: 1px 6px; margin-top: 2px;
}
.tp-cal-chip.active .tp-cal-chip-count { background: rgba(255,255,255,.25); color: #fff; }
.tp-cal-data-titulo { font-size: 12.5px; font-weight: 700; color: var(--text-muted); margin: 14px 0 10px; text-transform: capitalize; }
.tp-time-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.tp-time-pill {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--card);
  cursor: pointer; text-align: left; transition: all .15s ease;
}
.tp-time-pill:hover { border-color: var(--primary); background: var(--primary-soft); transform: translateY(-1px); }
.tp-time-pill-hora { font-family: var(--font-display); font-size: 17px; font-weight: 800; color: var(--text); }
.tp-time-pill-meta { font-size: 11px; color: var(--text-muted); }

.tp-stat-row { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 24px; }
.tp-stat-card {
  flex: 1 1 180px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 16px 18px; display: flex; align-items: center; gap: 14px;
}
.tp-stat-ic {
  width: 42px; height: 42px; border-radius: var(--radius-sm); flex-shrink: 0;
  background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center;
}
.tp-stat-label { font-size: 10.5px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.tp-stat-value { font-family: var(--font-display); font-size: 27px; font-weight: 800; color: var(--text); margin-top: 2px; line-height: 1.1; }

.tp-list-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 8px;
  transition: border-color .15s ease;
}
.tp-list-item:hover { border-color: var(--border-strong); }
.tp-list-main { display: flex; flex-direction: column; gap: 2px; }
.tp-list-data { font-size: 13px; font-weight: 700; color: var(--text); }
.tp-list-sub { font-size: 11.5px; color: var(--text-muted); }
.tp-badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 10.5px; font-weight: 700; }
.tp-badge-agendado { background: var(--warning-soft); color: var(--warning); }
.tp-badge-realizado { background: var(--success-soft); color: var(--success); }
.tp-badge-cancelado, .tp-badge-faltou { background: var(--danger-soft); color: var(--danger); }
.tp-badge-disponivel { background: var(--success-soft); color: var(--success); }
.tp-badge-reservado { background: var(--warning-soft); color: var(--warning); }
.tp-badge-bloqueado { background: var(--danger-soft); color: var(--danger); }

.tp-form-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.tp-form-row > * { flex: 1 1 160px; }
.tp-form-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; margin-bottom: 22px; }
.tp-form-card h3 { margin: 0 0 14px; font-size: 14px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 8px; }
.tp-checkbox-row { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.tp-dias-semana { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tp-dia-toggle { padding: 6px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-2); color: var(--text-muted); font-size: 11.5px; font-weight: 700; cursor: pointer; transition: all .15s ease; }
.tp-dia-toggle.active { background: var(--primary-soft); color: var(--primary); border-color: var(--primary); }

.tp-empty, .tp-loading, .tp-error { text-align: center; padding: 40px 16px; color: var(--text-muted); font-size: 13px; }
.tp-error { color: var(--danger); }

.tp-modal-body label { display: block; margin-bottom: 6px; font-size: 10px; color: var(--text-muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.tp-modal-body .form-input, .tp-modal-body select { width: 100%; margin-bottom: 12px; }

@media (max-width: 560px) {
  .tp-header { padding: 10px 12px; gap: 8px; }
  .tp-brand { gap: 8px; }
  .tp-brand-ic { width: 32px; height: 32px; }
  .tp-brand-sub, .tp-header-user-role { display: none; }
  .tp-header-right { gap: 6px; }
  .tp-header-user-block { gap: 6px; }
  .tp-header-user-name { max-width: 84px; font-size: 12px; }
  .tp-header-user-block .btn { padding: 0 10px; font-size: 11.5px; height: 30px; }
  #tp-tema-btn { width: 30px; height: 30px; }
  .tp-wrap { padding: 20px 14px 32px; }
  .tp-brand-title { font-size: 13px; }
  .tp-welcome-title { font-size: 19px; }
  .tp-slot { flex-basis: 100%; max-width: none; }
  .tp-stat-card { flex-basis: 100%; }
  .tp-login-card { padding: 24px 20px; }
}
@media (max-width: 360px) {
  .tp-brand-title { font-size: 11.5px; }
  .tp-header-user-name { max-width: 56px; }
}
