/* Agenda Social Turismo — folha única, mobile first, sem framework.
   Identidade: tokens da paleta OFICIAL da marca (MARKETING/IDENTIDADE VISUAL/Paleta de cores):
   azul principal #055FB4, azul escuro #05285F, azul claro #5FAFFA, laranja (acento) #FF781E.
   Tipografia web do site: Sora (títulos) + Roboto (corpo), com fallback de sistema.

   CONTRASTE VALIDADO (WCAG 2.x, AA) — não reverter sem recalcular:
   texto #05285F sobre laranja #FF781E 5,39:1 (hover #FF8A3D 6,07:1) · #05285F sobre WhatsApp #25D366 7,18:1
   (hover #1EBE5A 5,81:1) · branco sobre #055FB4 6,36:1 · --muted #5D6875: 5,67:1 no branco, 5,34:1 no --bg ·
   --accent-dark #B8500F 5,01:1 no branco · borda de campo --line-strong #7B8794 3,66:1 no branco ·
   foco: contorno 3px #05285F (14,24:1 no branco, 5,39:1 contra o laranja). Branco sobre laranja = 2,64:1 (PROIBIDO). */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@600;700&family=Roboto:wght@400;500;700&display=swap');

:root {
  --brand: #055FB4;        /* azul principal — cor-mãe (links, títulos, seleção) */
  --brand-dark: #05285F;   /* azul escuro — cabeçalhos, hover, texto sobre laranja, foco */
  --brand-light: #5FAFFA;  /* azul claro — realces */
  --brand-soft: #e7f1fc;   /* fundo claro derivado do azul */
  --accent: #FF781E;       /* laranja — cor de ação/destaque (fundo; texto sobre ele é sempre --brand-dark) */
  --accent-hover: #FF8A3D; /* laranja mais claro no hover: aumenta o contraste com o texto azul-escuro */
  --accent-dark: #B8500F;  /* laranja escurecido — único tom de laranja permitido como COR DE TEXTO (5,01:1) */
  --ink: #1f2933;
  --ink-soft: #3a4654;
  --muted: #5D6875;        /* era #6b7785 (4,29:1 no --bg) */
  --line: #E3E7EB;         /* divisórias decorativas apenas */
  --line-strong: #7B8794;  /* contorno de componentes (campos, botão fantasma): ≥ 3:1 */
  --bg: #F7F8FA;
  --card: #ffffff;
  --ok: #0a7a4a;
  --ok-soft: #e3f6ec;
  --warn: #854f0b;
  --warn-soft: #faeeda;
  --error: #b42318;
  --error-soft: #fdeaea;
  --whatsapp: #25D366;
  --whatsapp-hover: #1EBE5A;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 42, 77, .05), 0 8px 24px rgba(16, 42, 77, .06);
  --font: "Roboto", system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-head: "Sora", "Roboto", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --focus-color: var(--brand-dark);
  --focus-width: 3px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg);
  line-height: 1.5; font-size: 16px; min-height: 100vh; display: flex; flex-direction: column;
}
img { max-width: 100%; height: auto; }
a { color: var(--brand); }
a:hover { color: var(--brand-dark); }
h1, h2, h3 { font-family: var(--font-head); line-height: 1.2; margin: 0 0 .5rem; color: var(--brand-dark); }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1rem; }
.muted { color: var(--muted); font-size: .92rem; }
.small { font-size: .9rem; }
.lead { font-size: 1.08rem; color: var(--ink-soft); }

.container { width: 100%; max-width: 960px; margin: 0 auto; padding: 0 16px; }
.main { flex: 1; padding: 20px 16px 40px; }
.main-narrow { max-width: 640px; }
.main-wide { max-width: 1200px; }
body.admin .container { max-width: 1200px; } /* cabeçalho/rodapé alinhados ao conteúdo largo do painel */

/* Acessibilidade */
.skip-link { position: absolute; left: -9999px; top: 8px; background: var(--card); padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip-link:focus { left: 8px; }
/* Foco visível: contorno sólido azul-escuro, afastado 2px — legível sobre branco, --bg, azul-claro e laranja. */
:focus-visible { outline: var(--focus-width) solid var(--focus-color); outline-offset: 2px; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* Cabeçalho e rodapé */
.banner-test { background: var(--warn-soft); color: var(--warn); text-align: center; padding: 6px 12px; font-size: .9rem; }
.site-header { background: var(--card); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand img { display: block; height: 40px; width: 40px; }
.brand-name { font-family: var(--font-head); font-weight: 700; font-size: 1.15rem; color: var(--brand-dark); letter-spacing: -.01em; white-space: nowrap; }
.header-nav { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.header-nav a { text-decoration: none; font-weight: 600; font-size: .95rem; }
.tz-badge { font-size: .8rem; color: var(--ink-soft); background: var(--brand-soft); padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
@media (max-width: 400px) {
  .brand-name { font-size: 1.05rem; }
  .tz-badge { font-size: .72rem; padding: 3px 8px; }
}
.site-footer { background: var(--card); border-top: 1px solid var(--line); color: var(--ink-soft); font-size: .9rem; padding: 20px 0; }
.site-footer a { display: inline-block; padding: 6px 0; } /* alvo de toque mais alto que a linha de texto */
.footer-inner { display: grid; gap: 12px; }
@media (min-width: 640px) { .footer-inner { grid-template-columns: 1fr 1fr; } }

/* Cartões e layout */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.card-center { text-align: center; max-width: 560px; margin: 24px auto; }
.stack > * + * { margin-top: 12px; }
.grid-2 { display: grid; gap: 16px; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.row-between { justify-content: space-between; }
.spacer { flex: 1; }

/* Passos do fluxo público */
.steps { display: flex; gap: 8px; list-style: none; padding: 0; margin: 0 0 20px; font-size: .85rem; color: var(--muted); flex-wrap: wrap; }
.steps li { display: flex; align-items: center; gap: 6px; }
.steps li::before { content: attr(data-n); display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--line); color: var(--ink-soft); font-weight: 700; font-size: .75rem; }
.steps li.is-active { color: var(--brand-dark); font-weight: 600; }
.steps li.is-active::before { background: var(--accent); color: var(--brand-dark); }
.steps li.is-done::before { background: var(--ok); color: #fff; content: "✓"; }
/* Celular estreito: só a etapa atual mostra o rótulo; as demais ficam como número (o texto segue no leitor de tela). */
@media (max-width: 420px) { .steps li:not(.is-active) { font-size: 0; gap: 0; } }

/* Opções de modalidade */
.choice-grid { display: grid; gap: 14px; }
@media (min-width: 640px) { .choice-grid { grid-template-columns: 1fr 1fr; } }
.choice { display: block; text-decoration: none; color: inherit; background: var(--card); border: 2px solid var(--line); border-radius: var(--radius); padding: 20px; transition: border-color .15s, transform .15s; }
.choice:hover, .choice:focus-visible { border-color: var(--brand); color: inherit; }
.choice h2 { color: var(--brand-dark); margin-bottom: 4px; }
.choice .icon { font-size: 1.6rem; display: block; margin-bottom: 8px; }
.choice p { margin: 0; color: var(--ink-soft); }

/* Botões — laranja = ação, sempre com texto azul-escuro (nunca branco). */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 18px; border-radius: var(--radius-sm); border: 1px solid transparent; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--brand-dark); }
.btn-primary:hover { background: var(--accent-hover); color: var(--brand-dark); }
.btn-ghost { background: transparent; border-color: var(--line-strong); color: var(--ink); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand-dark); }
.btn-danger { background: var(--error-soft); color: var(--error); border-color: transparent; }
.btn-danger:hover { background: #f9d6d2; color: var(--error); }
.btn-whatsapp { background: var(--whatsapp); color: var(--brand-dark); }
.btn-whatsapp:hover { background: var(--whatsapp-hover); color: var(--brand-dark); }
.btn-block { width: 100%; }
.btn-sm { min-height: 40px; padding: 6px 12px; font-size: .9rem; }
@media (max-width: 720px) { .btn-sm { min-height: 44px; } }

/* Calendário de dias e horários */
.cal-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.cal-month { font-weight: 700; } /* sem text-transform: a capitalização correta vem do servidor ("Outubro de 2026") */
.cal-weekdays, .cal-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-weekdays { font-size: .75rem; color: var(--muted); text-align: center; text-transform: uppercase; margin-bottom: 4px; }
.cal-day { display: grid; place-items: center; aspect-ratio: 1 / 1; min-height: 44px; border-radius: 10px; border: 1px solid transparent; font-weight: 600; text-decoration: none; color: var(--ink); background: transparent; font: inherit; }
.cal-day.is-available { background: var(--brand-soft); color: var(--brand-dark); border-color: transparent; font-weight: 700; }
.cal-day.is-available:hover { border-color: var(--brand); }
.cal-day.is-selected { background: var(--brand); color: #fff; }
.cal-day.is-disabled { color: var(--line-strong); cursor: default; } /* sem opacity: 3,66:1, legível e ainda distinto dos dias livres */
.cal-day.is-empty { visibility: hidden; }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.slot { min-height: 48px; border: 1.5px solid var(--brand); border-radius: var(--radius-sm); background: var(--card); color: var(--brand-dark); font-weight: 700; font-size: 1.05rem; text-decoration: none; display: grid; place-items: center; }
.slot:hover, .slot:focus-visible { background: var(--brand); color: #fff; }
.slot.is-selected { background: var(--brand); color: #fff; }
.empty-state { padding: 20px; text-align: center; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); }

/* Formulários */
.form-group { margin-bottom: 16px; }
label { display: block; font-weight: 600; margin-bottom: 6px; }
.help { color: var(--ink-soft); font-size: .92rem; margin: -2px 0 8px; }
input[type="text"], input[type="email"], input[type="tel"], input[type="password"], input[type="date"], input[type="time"], input[type="url"], input[type="number"], select, textarea {
  width: 100%; font: inherit; padding: 12px 14px; border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm); background: #fff; color: var(--ink); min-height: 48px;
}
textarea { min-height: 140px; resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: var(--ink-soft); }
/* :focus (e não só :focus-visible) para que select/checkbox focados por clique também mostrem o contorno. */
input:focus, select:focus, textarea:focus { outline: var(--focus-width) solid var(--focus-color); outline-offset: 1px; border-color: var(--brand); box-shadow: none; }
.is-invalid, input[aria-invalid="true"], textarea[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--error) !important; }
.field-error { color: var(--error); font-size: .9rem; margin-top: 6px; }
.form-note { font-size: .88rem; color: var(--muted); }
.honeypot { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.check input { width: 20px; height: 20px; margin-top: 3px; accent-color: var(--brand); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--brand); }
.counter { text-align: right; font-size: .82rem; color: var(--muted); }

/* Resumo da reunião */
.summary { display: grid; gap: 8px; }
.summary dt { color: var(--muted); font-size: .85rem; }
.summary dd { margin: 0 0 6px; font-weight: 600; }
.summary .subject { font-weight: 400; white-space: pre-wrap; background: var(--bg); padding: 12px; border-radius: var(--radius-sm); border: 1px solid var(--line); }
.when { font-size: 1.25rem; font-weight: 700; color: var(--brand-dark); }

/* Alertas */
.flash, .alert { padding: 12px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; border: 1px solid transparent; }
.flash-ok, .alert-ok { background: var(--ok-soft); color: var(--ok); }
.flash-warn, .alert-warn { background: var(--warn-soft); color: var(--warn); }
.flash-error, .alert-error { background: var(--error-soft); color: var(--error); }
.alert-info { background: var(--brand-soft); color: var(--brand-dark); }

/* Badges e tabelas do painel */
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; background: var(--line); color: var(--ink-soft); white-space: nowrap; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-error { background: var(--error-soft); color: var(--error); }
.badge-brand { background: var(--brand-soft); color: var(--brand-dark); }
/* position: relative contém os .visually-hidden (antes eles escapavam e alargavam a página no celular). */
.table-wrap { position: relative; overflow-x: auto; }
.table-wrap:focus-visible { outline-offset: 0; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .8rem; text-transform: uppercase; color: var(--muted); letter-spacing: .02em; }
tr:hover td { background: var(--bg); }
.preview { color: var(--ink-soft); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Tabelas em "cartões" no celular: <table class="responsive"> + <td data-label="…">.
   O rótulo fica numa coluna fixa à esquerda (posicionado), e o conteúdo da célula — que pode ter texto,
   <br>, badge e link juntos — continua em fluxo normal à direita, sem ser quebrado em itens flex. */
@media (max-width: 720px) {
  table.responsive, table.responsive tbody, table.responsive tr { display: block; width: 100%; }
  table.responsive thead { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
  table.responsive tr { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 12px; margin-bottom: 10px; background: var(--card); }
  table.responsive tr:hover td { background: transparent; }
  table.responsive td { display: block; position: relative; min-width: 0; max-width: none; border: 0; padding: 6px 0; overflow-wrap: anywhere; }
  table.responsive td + td { border-top: 1px solid var(--line); }
  table.responsive td[data-label] { padding-left: calc(7.5rem + 12px); min-height: 2.1em; }
  table.responsive td[data-label]::before {
    content: attr(data-label); position: absolute; left: 0; top: 7px; width: 7.5rem;
    font-weight: 600; color: var(--muted); font-size: .8rem; line-height: 1.4; white-space: normal;
  }
  table.responsive td:not([data-label]):empty { display: none; }
  table.responsive td.nowrap { white-space: normal; }
}

/* Grade de horários (Configurações) no celular: cada dia vira bloco, o campo ocupa a largura toda. */
@media (max-width: 640px) {
  table.grid-table thead { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); }
  table.grid-table, table.grid-table tbody { display: block; }
  table.grid-table tr { display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
  table.grid-table td { border: 0; padding: 2px 0; }
  table.grid-table td:last-child { grid-column: 1 / -1; }
  table.grid-table tr:hover td { background: transparent; }
}

/* Painel */
.admin-nav { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.admin-nav a { padding: 10px 14px; text-decoration: none; color: var(--ink-soft); font-weight: 600; border-bottom: 2px solid transparent; }
.admin-nav a.is-active, .admin-nav a:hover { color: var(--brand-dark); border-bottom-color: var(--accent); }
@media (max-width: 640px) {
  /* Uma linha rolável em vez de três linhas quebradas; foco desenhado para dentro (não é cortado pelo overflow). */
  .admin-nav { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .admin-nav a { padding: 10px; white-space: nowrap; flex: 0 0 auto; }
  .admin-nav a:focus-visible, .admin-nav button:focus-visible { outline-offset: -3px; }
}
/* minmax(0, 1fr): colunas iguais mesmo com eventos longos; o cabeçalho (.admin-cal-head) usa a mesma grade e fica alinhado. */
.admin-cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.admin-cal .day { min-width: 0; min-height: 90px; border: 1px solid var(--line); border-radius: 8px; padding: 6px; background: var(--card); font-size: .8rem; }
.admin-cal .day.is-today { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.admin-cal .day.is-other { background: var(--bg); } /* sem opacity: o texto dos eventos mantém o contraste */
.admin-cal .day.is-other .day-n { color: var(--muted); font-weight: 600; }
.admin-cal .day-n { font-weight: 700; color: var(--ink-soft); }
.admin-cal .evt { display: block; min-width: 0; min-height: 28px; margin-top: 4px; padding: 4px 6px; border-radius: 6px; background: var(--brand-soft); color: var(--brand-dark); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.evt:hover { box-shadow: inset 0 0 0 1px var(--brand); }
.admin-cal a.evt:focus-visible { outline-offset: 1px; }
.admin-cal .evt-block { background: var(--line); color: var(--ink-soft); }
.admin-cal .evt-warn { background: var(--warn-soft); color: var(--warn); }
@media (max-width: 720px) {
  .admin-cal { grid-template-columns: 1fr; }
  .admin-cal .day.is-other { display: none; }
  .admin-cal .day { min-height: 0; }
  .admin-cal .evt { min-height: 40px; display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
}

/* Utilidades */
.text-center { text-align: center; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-wrap; }

/* Quem prefere menos movimento */
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
