/* ============================================================
   OAKBERRY — Design System do site CMV
   Base: OAK PURPLE + OAK OFF WHITE. Frutas só como acento.
   Tipografia: Nexa Slab (self-hosted). Ícones: linha (Lucide).
   ============================================================ */
@font-face { font-family: "Nexa Slab"; src: url("/brand/fonts/NexaSlab-Light.otf") format("opentype");   font-weight: 300; font-display: swap; }
@font-face { font-family: "Nexa Slab"; src: url("/brand/fonts/NexaSlab-Book.otf") format("opentype");    font-weight: 400; font-display: swap; }
@font-face { font-family: "Nexa Slab"; src: url("/brand/fonts/NexaSlab-Regular.otf") format("opentype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Nexa Slab"; src: url("/brand/fonts/NexaSlab-Bold.otf") format("opentype");    font-weight: 700; font-display: swap; }
@font-face { font-family: "Nexa Slab"; src: url("/brand/fonts/NexaSlab-Heavy.otf") format("opentype");   font-weight: 800; font-display: swap; }
@font-face { font-family: "Nexa Slab"; src: url("/brand/fonts/NexaSlab-Black.otf") format("opentype");   font-weight: 900; font-display: swap; }

:root {
  /* Marca */
  --purple: #3E2160;        /* OAK PURPLE */
  --deep:   #2A1545;        /* roxo profundo */
  --plum:   #542C82;        /* roxo claro (hover / gradiente) */
  --off:    #F4EFE2;        /* OAK OFF WHITE */
  --white:  #FFFFFF;
  /* Acentos (frutas) — uso pontual */
  --honey:      #E8A33D;
  --strawberry: #E5435A;
  --matcha:     #46C3AF;
  --blueberry:  #5B94B7;
  /* Neutros derivados */
  --ink:       #2A1545;
  --ink-soft:  #6B5E80;
  --ink-mute:  #9A8FAA;
  --line:      #E6DFEC;
  --line-soft: #F0EBF4;
  --lilac:     #F6F1FA;
  --lilac-2:   #ECE3F3;
  --ok-bg:     #E6F6F2;  --ok-ink:    #0F6E5B;
  --warn-bg:   #FCF3E3;  --warn-ink:  #7A4E0B;  --warn-line: #F0CF8E;
  --err-bg:    #FCE9EC;  --err-ink:   #A31F33;  --err-line:  #F2B3BD;
  /* Forma */
  --font: "Nexa Slab", "Segoe UI", Roboto, Arial, sans-serif;
  --r-xs: 8px; --r-sm: 12px; --r-md: 16px; --r-lg: 20px; --r-pill: 999px;
  --sh-1: 0 1px 2px rgba(42,21,69,.05), 0 2px 8px rgba(42,21,69,.06);
  --sh-2: 0 4px 12px rgba(42,21,69,.08), 0 12px 32px rgba(42,21,69,.10);
  --sh-purple: 0 12px 32px rgba(62,33,96,.32);
  --focus: 0 0 0 3px rgba(84,44,130,.30);
  --touch: 44px;
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px; --sp-7: 32px; --sp-8: 48px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font); font-weight: 400; color: var(--ink);
  background: var(--off);
  min-height: 100vh; min-height: 100dvh;   /* vh como reserva p/ navegadores sem dvh */
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  display: flex; flex-direction: column;
}
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Ícones de linha */
.ic { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic-sm { width: 16px; height: 16px; }

/* ============ HEADER ============ */
.topbar {
  background: linear-gradient(135deg, var(--purple) 0%, var(--deep) 100%);
  color: var(--off);
  padding: calc(var(--sp-3) + env(safe-area-inset-top, 0px)) var(--sp-4) var(--sp-3);
  position: sticky; top: 0; z-index: 20;
  box-shadow: 0 2px 12px rgba(42,21,69,.25);
}
.topbar-in { max-width: 1040px; margin: 0 auto; display: flex; align-items: center; gap: var(--sp-4); min-height: 48px; }
.brand { display: flex; align-items: center; gap: var(--sp-3); text-decoration: none; color: inherit; min-width: 0; }
.brand img { height: 30px; width: auto; display: block; }
.brand-sep { display: none; width: 1px; height: 26px; background: rgba(244,239,226,.28); }
.brand-title { display: none; font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: rgba(244,239,226,.85); white-space: nowrap; }
@media (min-width: 640px) { .brand-sep, .brand-title { display: inline-block; } }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: var(--sp-2); }

.btn-ghost {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  min-height: 40px; padding: 0 var(--sp-3);
  background: rgba(244,239,226,.10); border: 1px solid rgba(244,239,226,.28);
  border-radius: var(--r-pill); color: var(--off);
  font-size: 13px; font-weight: 700; cursor: pointer; text-decoration: none;
  transition: background .15s, border-color .15s;
}
.btn-ghost:hover { background: rgba(244,239,226,.18); border-color: rgba(244,239,226,.5); }
.btn-ghost:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(244,239,226,.35); }
.btn-ghost .lbl { display: none; }
@media (min-width: 560px) { .btn-ghost .lbl { display: inline; } }

.user { position: relative; }
.user-btn {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  min-height: 40px; padding: 3px 4px 3px 3px; border-radius: var(--r-pill);
  background: transparent; border: 1px solid transparent; color: var(--off); cursor: pointer;
}
.user-btn:hover, .user-btn[aria-expanded="true"] { background: rgba(244,239,226,.10); border-color: rgba(244,239,226,.28); }
.user-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(244,239,226,.35); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: var(--off); color: var(--purple); font-size: 12px; font-weight: 900; letter-spacing: .02em;
}
.user-btn .ic { width: 16px; height: 16px; opacity: .8; }
.user-menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 250px;
  background: var(--white); color: var(--ink); border: 1px solid var(--line);
  border-radius: var(--r-md); box-shadow: var(--sh-2); padding: var(--sp-2); z-index: 30;
}
.user-menu .who { padding: var(--sp-2) var(--sp-3) var(--sp-3); border-bottom: 1px solid var(--line-soft); margin-bottom: var(--sp-2); }
.user-menu .who .n { font-weight: 800; font-size: 14px; }
.user-menu .who .e { font-size: 12px; color: var(--ink-soft); word-break: break-all; }
.user-menu .tag { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; padding: 2px 8px; border-radius: var(--r-pill); background: var(--lilac-2); color: var(--purple); font-size: 11px; font-weight: 800; }
.user-menu a, .user-menu button {
  display: flex; align-items: center; gap: var(--sp-2); width: 100%; min-height: 40px; padding: 0 var(--sp-3);
  border: 0; background: transparent; border-radius: var(--r-xs); text-decoration: none; color: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
}
.user-menu a:hover, .user-menu button:hover { background: var(--lilac); }

/* ============ LAYOUT ============ */
main { flex: 1; width: 100%; max-width: 640px; margin: 0 auto; padding: var(--sp-5) var(--sp-4) var(--sp-8); }
main.wide { max-width: 1040px; }
.page-head { margin: var(--sp-2) 0 var(--sp-5); }
.page-head h1 { font-size: 26px; font-weight: 900; line-height: 1.1; color: var(--purple); letter-spacing: -.01em; }
.page-head p { margin-top: var(--sp-2); font-size: 14px; color: var(--ink-soft); line-height: 1.5; }
.eyebrow { font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--plum); font-style: italic; }
footer.site { text-align: center; padding: var(--sp-5) var(--sp-4); font-size: 12px; letter-spacing: .02em; color: var(--ink-mute); }
footer.site strong { color: var(--ink-soft); font-weight: 800; letter-spacing: .06em; }

/* ============ CARDS ============ */
.card {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: var(--sp-5); margin-bottom: var(--sp-4); box-shadow: var(--sh-1);
}
.card-head { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.step {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--purple); color: var(--off); font-size: 13px; font-weight: 900;
}
.card h2 { font-size: 16px; font-weight: 800; color: var(--purple); line-height: 1.2; }
.card .hint { font-size: 13.5px; color: var(--ink-soft); line-height: 1.55; margin: calc(-1 * var(--sp-2)) 0 var(--sp-4); max-width: 60ch; }

label { display: block; font-size: 13px; font-weight: 700; margin-bottom: var(--sp-2); }

/* ============ CAMPOS ============ */
select, input.num, input.txt {
  width: 100%; min-height: 48px; padding: var(--sp-3) var(--sp-3);
  font-weight: 500; font-size: 15px;
  border: 1.5px solid var(--line); border-radius: var(--r-sm); background: var(--white);
  transition: border-color .15s, box-shadow .15s;
}
select {
  appearance: none; -webkit-appearance: none; padding-right: 40px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1 1l6 6 6-6' fill='none' stroke='%233E2160' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
select:hover, input:hover { border-color: var(--plum); }
select:focus-visible, input:focus-visible { outline: none; border-color: var(--purple); box-shadow: var(--focus); }
optgroup { font-weight: 800; color: var(--purple); }
input.num { text-align: right; font-variant-numeric: tabular-nums; }
input.invalido { border-color: var(--strawberry); background: var(--err-bg); }
input.check { width: 22px; height: 22px; accent-color: var(--purple); cursor: pointer; }

/* ============ BOTÕES ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  width: 100%; min-height: 48px; padding: var(--sp-3) var(--sp-4);
  font-size: 15px; font-weight: 800; border: 1.5px solid transparent; border-radius: var(--r-sm);
  cursor: pointer; text-decoration: none;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .08s;
}
.btn:active { transform: scale(.985); }
.btn:focus-visible { outline: none; box-shadow: var(--focus); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--purple); color: var(--off); }
.btn-primary:hover { background: var(--plum); }
.btn-soft { background: var(--lilac); color: var(--purple); border-color: var(--lilac-2); }
.btn-soft:hover { background: var(--lilac-2); border-color: var(--plum); }
.btn-outline { background: var(--white); color: var(--purple); border-color: var(--line); }
.btn-outline:hover { border-color: var(--plum); background: var(--lilac); }
.btn-danger { background: var(--white); color: var(--strawberry); border-color: var(--strawberry); }
.btn-danger:hover { background: var(--err-bg); }
.btn-danger:focus-visible { box-shadow: 0 0 0 3px rgba(229,67,90,.28); }
.btn-row { display: flex; flex-direction: column; gap: var(--sp-2); margin-top: var(--sp-3); }
@media (min-width: 480px) { .btn-row { flex-direction: row; } .btn-row .btn { width: auto; flex: 1; } }
.btn-icon {
  width: var(--touch); height: var(--touch); flex: none; display: grid; place-items: center;
  border: 1.5px solid var(--line); border-radius: var(--r-sm); background: var(--white); color: var(--strawberry); cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn-icon:hover { background: var(--err-bg); border-color: var(--strawberry); }
.btn-icon:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(229,67,90,.28); }

/* ============ AVISOS ============ */
.aviso { display: flex; gap: var(--sp-2); align-items: flex-start; border-radius: var(--r-sm); padding: var(--sp-3); margin-top: var(--sp-3); font-size: 13px; font-weight: 500; line-height: 1.45; }
.aviso .ic { width: 18px; height: 18px; margin-top: 1px; }
.aviso-warn { background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn-ink); }
.aviso-err  { background: var(--err-bg);  border: 1px solid var(--err-line);  color: var(--err-ink); }
.aviso-ok   { background: var(--ok-bg);   border: 1px solid #BFE6DB;          color: var(--ok-ink); }
.aviso-info { background: var(--lilac);   border: 1px solid var(--lilac-2);   color: var(--purple); }

/* ============ ESTADOS ============ */
.state { text-align: center; padding: var(--sp-8) var(--sp-4); color: var(--ink-soft); }
.state .ic { width: 40px; height: 40px; color: var(--plum); margin: 0 auto var(--sp-3); }
.state h3 { font-size: 17px; font-weight: 800; color: var(--purple); margin-bottom: var(--sp-2); }
.state p { font-size: 14px; line-height: 1.5; }
.state .btn { width: auto; margin-top: var(--sp-4); }
.skel { position: relative; overflow: hidden; background: var(--lilac); border-radius: var(--r-sm); min-height: 48px; }
.skel::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.7), transparent); animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }

/* ============ TOAST ============ */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--sp-5) + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%) translateY(20px);
  display: flex; align-items: center; gap: var(--sp-2); max-width: min(92vw, 480px);
  background: var(--deep); color: var(--off); padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md);
  box-shadow: var(--sh-purple); font-size: 14px; font-weight: 700; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast .ic { color: var(--matcha); }
.toast.err .ic { color: var(--strawberry); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
