/* ==========================================================================
   Vitta Agenda — Estilos base (compartilhados por todas as páginas)
   --------------------------------------------------------------------------
   1. Tokens de design (cores, tipografia, espaçamento, sombras)
   2. Reset e elementos básicos
   3. Layout (container, seções)
   4. Componentes: botões, formulários, cards, badges, avatar
   5. Cabeçalho e menu
   6. Rodapé
   7. Toasts, animações e utilitários
   Abordagem mobile-first: estilos base para telas pequenas,
   media queries (min-width) acrescentam o layout de telas maiores.
   ========================================================================== */

/* 1. TOKENS ================================================================ */
:root {
  /* Azul-petróleo (cor principal) */
  --petrol-950: #042229;
  --petrol-900: #06303a;
  --petrol-800: #0a4250;
  --petrol-700: #0b5566;   /* primária — contraste 8:1 sobre branco */
  --petrol-600: #0f6b7e;
  --petrol-500: #16849a;
  --petrol-200: #b9dde4;
  --petrol-100: #ddeff2;
  --petrol-50:  #eff7f8;

  /* Verde suave (confirmações / sucesso) */
  --green-700: #1a7a50;    /* texto verde — contraste 5.2:1 */
  --green-500: #34a877;
  --green-100: #ddf3e8;
  --green-50:  #effaf4;

  /* Apoio */
  --amber-500: #e9a23b;
  --amber-100: #fcf0dc;
  --red-700:   #b3261e;
  --red-100:   #fbe4e2;

  /* Neutros */
  --bg:        #f6f9fa;
  --surface:   #ffffff;
  --ink:       #0f1f24;    /* texto principal */
  --ink-2:     #43555b;    /* texto secundário — 7.4:1 */
  --ink-3:     #5f7076;    /* texto auxiliar  — 5.1:1 */
  --line:      #e2eaec;
  --line-2:    #cfdadd;

  /* Tipografia */
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --fs-xs: .8125rem;  /* 13px */
  --fs-sm: .875rem;   /* 14px */
  --fs-md: 1rem;      /* 16px */
  --fs-lg: 1.125rem;  /* 18px */
  --fs-xl: 1.375rem;  /* 22px */
  --fs-2xl: clamp(1.625rem, 1.2rem + 1.8vw, 2.25rem);
  --fs-3xl: clamp(2.25rem, 1.4rem + 3.8vw, 4rem);

  /* Espaçamento, raio e sombra */
  --space-1: .25rem; --space-2: .5rem; --space-3: .75rem; --space-4: 1rem;
  --space-5: 1.5rem; --space-6: 2rem;  --space-7: 3rem;   --space-8: 4.5rem;
  --radius-sm: 10px;
  --radius:    14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 999px;
  --shadow-sm: 0 1px 2px rgba(6, 48, 58, .06), 0 1px 3px rgba(6, 48, 58, .05);
  --shadow:    0 4px 14px -4px rgba(6, 48, 58, .10), 0 2px 6px -2px rgba(6, 48, 58, .06);
  --shadow-lg: 0 24px 48px -16px rgba(6, 48, 58, .20), 0 8px 16px -8px rgba(6, 48, 58, .08);
  --ring: 0 0 0 3px rgba(22, 132, 154, .35);

  --ease: cubic-bezier(.2, .7, .2, 1);
  --header-h: 68px;
  --container: 1180px;
}

/* 2. RESET ================================================================= */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-md);
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
h1, h2, h3, h4 { margin: 0; line-height: 1.15; letter-spacing: -.02em; font-weight: 700; color: var(--ink); }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: var(--petrol-700); text-decoration: none; }
a:hover { color: var(--petrol-600); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

/* Foco visível só para teclado */
:focus { outline: none; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 6px; }

.skip-link {
  position: absolute; left: var(--space-4); top: -100px; z-index: 200;
  background: var(--petrol-900); color: #fff; padding: .6rem 1rem; border-radius: var(--radius-sm);
  font-weight: 600; transition: top .2s var(--ease);
}
.skip-link:focus-visible { top: var(--space-3); color: #fff; }

/* Garante que o atributo hidden sempre esconda, mesmo com display definido na classe */
[hidden] { display: none !important; }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* 3. LAYOUT ================================================================ */
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: 20px; }
@media (min-width: 768px) { .container { padding-inline: 32px; } }

main { display: block; padding-top: var(--header-h); }

.section { padding-block: var(--space-8); }
@media (min-width: 900px) { .section { padding-block: 6.5rem; } }

.section__head { max-width: 640px; margin-bottom: var(--space-7); }
.section__head--center { margin-inline: auto; text-align: center; }
.eyebrow {
  display: inline-flex; align-items: center; gap: .5rem;
  font-size: var(--fs-xs); font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--petrol-600); margin-bottom: var(--space-3);
}
.eyebrow::before { content: ''; width: 18px; height: 2px; border-radius: 2px; background: currentColor; }
.section__title { font-size: var(--fs-2xl); margin-bottom: var(--space-3); }
.section__lead { color: var(--ink-2); font-size: var(--fs-lg); }

/* 4. COMPONENTES =========================================================== */

/* --- Botões --- */
.btn {
  --btn-bg: var(--surface); --btn-fg: var(--ink); --btn-bd: var(--line-2);
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 48px; padding: .75rem 1.375rem;
  font-weight: 600; font-size: var(--fs-md); line-height: 1.2; white-space: nowrap;
  background: var(--btn-bg); color: var(--btn-fg);
  border: 1px solid var(--btn-bd); border-radius: var(--radius-full);
  transition: background-color .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease),
              transform .2s var(--ease), box-shadow .2s var(--ease);
}
.btn:hover { color: var(--btn-fg); border-color: var(--petrol-200); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:focus-visible { border-radius: var(--radius-full); }
.btn svg { width: 20px; height: 20px; flex-shrink: 0; transition: transform .2s var(--ease); }
.btn:hover svg:last-child:not(:first-child) { transform: translateX(3px); }

.btn--primary { --btn-bg: var(--petrol-700); --btn-fg: #fff; --btn-bd: var(--petrol-700); box-shadow: 0 6px 16px -6px rgba(11, 85, 102, .55); }
.btn--primary:hover { --btn-bg: var(--petrol-800); --btn-bd: var(--petrol-800); box-shadow: 0 10px 22px -8px rgba(11, 85, 102, .6); }
.btn--success { --btn-bg: var(--green-700); --btn-fg: #fff; --btn-bd: var(--green-700); }
.btn--success:hover { --btn-bg: #146642; --btn-bd: #146642; }
.btn--ghost { --btn-bg: transparent; --btn-bd: transparent; --btn-fg: var(--petrol-700); }
.btn--ghost:hover { --btn-bg: var(--petrol-50); }
.btn--light { --btn-bg: #fff; --btn-fg: var(--petrol-800); --btn-bd: #fff; }
.btn--danger { --btn-fg: var(--red-700); }
.btn--danger:hover { --btn-bg: var(--red-100); border-color: var(--red-100); }
.btn--sm { min-height: 40px; padding: .5rem 1rem; font-size: var(--fs-sm); }
.btn--lg { min-height: 56px; padding: 1rem 1.75rem; font-size: var(--fs-lg); }
.btn--block { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }

/* --- Formulários --- */
.field { display: flex; flex-direction: column; gap: .375rem; }
.field__label { font-size: var(--fs-sm); font-weight: 600; color: var(--ink); }
.field__label .req { color: var(--red-700); margin-left: 2px; }
.field__hint { font-size: var(--fs-xs); color: var(--ink-3); }
.field__error { font-size: var(--fs-xs); font-weight: 500; color: var(--red-700); min-height: 1em; }
.input, .select, .textarea {
  width: 100%; min-height: 48px; padding: .75rem 1rem;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  font-size: var(--fs-md); /* 16px evita zoom automático no iOS */
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.input::placeholder, .textarea::placeholder { color: #8a989d; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--petrol-200); }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { border-color: var(--petrol-500); box-shadow: var(--ring); border-radius: var(--radius-sm); }
.input[aria-invalid="true"], .select[aria-invalid="true"] { border-color: var(--red-700); }
.select {
  appearance: none; -webkit-appearance: none; padding-right: 2.75rem; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%235f7076' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 1rem center;
}
.textarea { min-height: 110px; resize: vertical; }

/* --- Cards --- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

/* --- Badges / chips --- */
.badge {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .25rem .625rem; border-radius: var(--radius-full);
  font-size: var(--fs-xs); font-weight: 600; line-height: 1.4;
  background: var(--petrol-50); color: var(--petrol-700);
}
.badge svg { width: 14px; height: 14px; }
.badge--success { background: var(--green-100); color: var(--green-700); }
.badge--warning { background: var(--amber-100); color: #8a5a10; }
.badge--danger { background: var(--red-100); color: var(--red-700); }
.badge--neutral { background: #eef2f3; color: var(--ink-2); }

/* --- Avatar placeholder (iniciais com gradiente) --- */
.avatar {
  --a1: var(--petrol-500); --a2: var(--petrol-800);
  display: grid; place-items: center; flex-shrink: 0;
  width: 56px; height: 56px; border-radius: 50%;
  background: linear-gradient(135deg, var(--a1), var(--a2));
  color: #fff !important; /* evita herdar cor de textos secundários do card */
  font-weight: 700; letter-spacing: .02em;
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .25);
}
.avatar--teal   { --a1: #2aa3b3; --a2: #0b5566; }
.avatar--blue   { --a1: #4b8fd6; --a2: #1d4e89; }
.avatar--rose   { --a1: #e48aa0; --a2: #a3405e; }
.avatar--amber  { --a1: #f0b55a; --a2: #b06d14; }
.avatar--violet { --a1: #9b8be0; --a2: #5242a3; }

/* --- Estrelas de avaliação --- */
.rating { display: inline-flex; align-items: center; gap: .3rem; font-size: var(--fs-sm); font-weight: 600; color: var(--ink); }
.rating svg { width: 16px; height: 16px; color: var(--amber-500); fill: var(--amber-500); }
.rating small { color: var(--ink-3); font-weight: 500; font-size: inherit; }

/* 5. CABEÇALHO ============================================================= */
.site-header {
  position: fixed; inset: 0 0 auto 0; z-index: 100; height: var(--header-h);
  background: rgba(246, 249, 250, .82);
  backdrop-filter: saturate(180%) blur(14px); -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .25s var(--ease), box-shadow .25s var(--ease), background-color .25s var(--ease);
}
.site-header.is-scrolled { border-bottom-color: var(--line); box-shadow: 0 6px 20px -14px rgba(6, 48, 58, .25); background: rgba(255, 255, 255, .9); }
.site-header__inner { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); }

.brand { display: inline-flex; align-items: center; gap: .6rem; color: var(--ink); font-weight: 700; font-size: 1.125rem; letter-spacing: -.02em; }
.brand:hover { color: var(--ink); }
.brand__mark {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px;
  background: linear-gradient(140deg, var(--petrol-500), var(--petrol-800)); color: #fff;
  box-shadow: 0 6px 14px -6px rgba(11, 85, 102, .7);
}
.brand__name span { color: var(--petrol-600); font-weight: 600; margin-left: 1px; }
.brand--light, .brand--light:hover { color: #fff; }
.brand--light .brand__name span { color: var(--petrol-200); }

.nav-toggle {
  display: grid; place-items: center; width: 44px; height: 44px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink);
}
.nav-toggle__close { display: none; }
body.menu-open .nav-toggle__open { display: none; }
body.menu-open .nav-toggle__close { display: block; }

/* Menu mobile: painel que desliza de cima */
.nav {
  position: fixed; inset: var(--header-h) 0 auto 0;
  background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: var(--shadow-lg);
  padding: var(--space-4) 20px var(--space-5);
  display: flex; flex-direction: column; gap: var(--space-4);
  opacity: 0; visibility: hidden; transform: translateY(-8px);
  transition: opacity .22s var(--ease), transform .22s var(--ease), visibility 0s linear .22s;
}
body.menu-open .nav { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.nav__list { display: flex; flex-direction: column; }
.nav__link {
  display: block; padding: .875rem .25rem; border-bottom: 1px solid var(--line);
  color: var(--ink); font-weight: 500; font-size: var(--fs-lg);
}
.nav__link.is-active { color: var(--petrol-700); font-weight: 600; }

@media (min-width: 900px) {
  .nav-toggle { display: none; }
  .nav {
    position: static; inset: auto; flex-direction: row; align-items: center; gap: var(--space-5);
    padding: 0; background: none; border: 0; box-shadow: none;
    opacity: 1; visibility: visible; transform: none;
  }
  .nav__list { flex-direction: row; gap: .25rem; }
  .nav__link {
    padding: .5rem .875rem; border: 0; border-radius: var(--radius-full);
    font-size: var(--fs-sm); color: var(--ink-2); transition: color .2s var(--ease), background-color .2s var(--ease);
  }
  .nav__link:hover { color: var(--ink); background: rgba(11, 85, 102, .06); }
  .nav__link.is-active { color: var(--petrol-700); background: var(--petrol-50); }
}

/* 6. RODAPÉ ================================================================ */
.site-footer { background: var(--petrol-950); color: #b8c9cd; padding-top: var(--space-8); font-size: var(--fs-sm); }
.site-footer a { color: #d3e1e4; transition: color .2s var(--ease); }
.site-footer a:hover { color: #fff; }
.site-footer__grid { display: grid; gap: var(--space-6); grid-template-columns: 1fr 1fr; }
.site-footer__brand { grid-column: 1 / -1; max-width: 340px; }
.site-footer__brand p { margin-top: var(--space-4); line-height: 1.7; }
.site-footer__title { font-size: var(--fs-sm); font-weight: 600; color: #fff; letter-spacing: 0; margin-bottom: var(--space-4); }
.site-footer ul { display: grid; gap: .625rem; }
.site-footer__contact li { display: flex; align-items: center; gap: .6rem; overflow-wrap: anywhere; }
.site-footer__contact svg { color: var(--petrol-200); flex-shrink: 0; }
.site-footer__bottom {
  margin-top: var(--space-7); padding-block: var(--space-5);
  border-top: 1px solid rgba(255, 255, 255, .1);
  display: flex; flex-direction: column; gap: var(--space-3);
  font-size: var(--fs-xs); color: #8fa6ab;
}
.site-footer__notice { display: inline-flex; align-items: center; gap: .4rem; color: #a9bec3; }
@media (min-width: 640px) { .site-footer__grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1024px) {
  .site-footer__grid { grid-template-columns: 1.6fr repeat(4, 1fr); }
  .site-footer__brand { grid-column: auto; }
  .site-footer__bottom { flex-direction: row; justify-content: space-between; align-items: center; }
}

/* 7. TOASTS, ANIMAÇÕES, UTILITÁRIOS ======================================= */
.toast-region {
  position: fixed; z-index: 300; left: 16px; right: 16px; bottom: 16px;
  display: flex; flex-direction: column; gap: .5rem; align-items: center; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: .6rem; max-width: 420px; width: 100%;
  padding: .875rem 1rem; border-radius: var(--radius);
  background: var(--petrol-900); color: #fff; box-shadow: var(--shadow-lg);
  font-size: var(--fs-sm); font-weight: 500;
  opacity: 0; transform: translateY(12px); transition: opacity .25s var(--ease), transform .25s var(--ease);
}
.toast svg { flex-shrink: 0; }
.toast--success svg { color: #7fdcb0; }
.toast--error { background: #4a1612; }
.toast--error svg { color: #ffb4ab; }
.toast.is-visible { opacity: 1; transform: none; }

/* Revelação suave ao rolar */
[data-reveal] { opacity: 0; transform: translateY(16px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
[data-reveal].is-revealed { opacity: 1; transform: none; }
[data-reveal-delay="1"] { transition-delay: .08s; }
[data-reveal-delay="2"] { transition-delay: .16s; }
[data-reveal-delay="3"] { transition-delay: .24s; }

/* Sem JS (ou JS falhou): conteúdo sempre visível */
.no-js [data-reveal] { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  [data-reveal] { opacity: 1; transform: none; }
}

.text-muted { color: var(--ink-2); }
.text-success { color: var(--green-700); }

/* 8. COMPONENTES DE PÁGINAS INTERNAS ====================================== */

/* --- Cabeçalho de página interna --- */
.page-head {
  padding: 2rem 0 1.75rem;
  background:
    radial-gradient(40rem 18rem at 90% -20%, rgba(22, 132, 154, .14), transparent 60%),
    linear-gradient(180deg, #eef6f7, var(--bg));
  border-bottom: 1px solid var(--line);
}
.page-head__title { font-size: var(--fs-2xl); margin-top: var(--space-3); }
.page-head__lead { margin-top: var(--space-2); color: var(--ink-2); max-width: 40rem; }
@media (min-width: 900px) { .page-head { padding: 2.75rem 0 2.25rem; } }

/* --- Breadcrumb --- */
.breadcrumb ol { display: flex; flex-wrap: wrap; gap: .375rem; font-size: var(--fs-sm); color: var(--ink-3); }
.breadcrumb li { display: inline-flex; align-items: center; gap: .375rem; }
.breadcrumb li + li::before { content: '/'; color: var(--line-2); }
.breadcrumb a { color: var(--ink-2); }
.breadcrumb a:hover { color: var(--petrol-700); text-decoration: underline; text-underline-offset: 3px; }
.breadcrumb [aria-current] { color: var(--ink); font-weight: 500; }

/* --- Select compacto --- */
.select--sm { min-height: 40px; padding: .5rem 2.5rem .5rem .875rem; font-size: var(--fs-sm); background-position: right .75rem center; }

/* --- Grupo de opções em formato de "chip" (radio/checkbox estilizados) --- */
.fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.fieldset > legend { padding: 0; margin-bottom: .5rem; }
.chips-group { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip-radio { position: relative; cursor: pointer; }
.chip-radio input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip-radio span {
  display: inline-flex; align-items: center; min-height: 38px; padding: .45rem .9rem;
  border: 1px solid var(--line-2); border-radius: var(--radius-full); background: var(--surface);
  font-size: var(--fs-sm); font-weight: 500; color: var(--ink-2);
  transition: background-color .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease);
}
.chip-radio:hover span { border-color: var(--petrol-200); color: var(--ink); }
.chip-radio input:checked + span { background: var(--petrol-700); border-color: var(--petrol-700); color: #fff; }
.chip-radio input:focus-visible + span { box-shadow: var(--ring); }

/* --- Controle deslizante (range) --- */
.range { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: transparent; cursor: pointer; }
.range::-webkit-slider-runnable-track { height: 6px; border-radius: 6px; background: linear-gradient(to right, var(--petrol-600) var(--fill, 100%), var(--line) var(--fill, 100%)); }
.range::-moz-range-track { height: 6px; border-radius: 6px; background: var(--line); }
.range::-moz-range-progress { height: 6px; border-radius: 6px; background: var(--petrol-600); }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -8px; border-radius: 50%; background: #fff; border: 2px solid var(--petrol-700); box-shadow: var(--shadow); transition: transform .15s var(--ease); }
.range::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 2px solid var(--petrol-700); box-shadow: var(--shadow); }
.range:hover::-webkit-slider-thumb { transform: scale(1.1); }
.range:focus-visible { box-shadow: none; }
.range:focus-visible::-webkit-slider-thumb { box-shadow: var(--ring); }
.range:focus-visible::-moz-range-thumb { box-shadow: var(--ring); }

/* --- Estado vazio --- */
.empty { padding: var(--space-7) var(--space-5); text-align: center; display: flex; flex-direction: column; align-items: center; gap: var(--space-3); }
.empty__icon { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--petrol-50); color: var(--petrol-700); margin-bottom: var(--space-2); }
.empty h2 { font-size: var(--fs-xl); }
.empty p { color: var(--ink-2); max-width: 26rem; margin-bottom: var(--space-3); }

/* Trava a rolagem do fundo quando um painel/modal está aberto */
body.no-scroll { overflow: hidden; }

/* MA Code — faixa de demonstração e carimbo */
.demo-banner { display: flex; align-items: center; justify-content: center; gap: .45rem; padding: .55rem 16px;
  background: #fff4d6; color: #6b4a00; font-size: .8125rem; line-height: 1.35; text-align: center;
  border-bottom: 1px solid #f1dfa8; }
.demo-banner svg { flex: none; }
.site-footer__contact a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.macode-stamp { color: #cfe0e3; text-decoration: none; }
.macode-stamp:hover, .macode-stamp:focus-visible { color: #fff; text-decoration: underline; }
