/* =====================================================================================
   Conecta Cuidado · Marketplace · app.css
   Tokens do protótipo e do piloto — regra: zero hex cru fora do :root (CLAUDE.md §4).
   Público-alvo: cuidadoras 30–55 anos, baixa literacia digital → alvos grandes, texto ≥16px.
   ===================================================================================== */
:root {
  color-scheme: only light;
  --cc-primary:        #0D6B45;
  --cc-primary-dark:   #084A31;
  --cc-primary-soft:   #EAF6F0;
  --cc-info:           #2F6EA3;
  --cc-info-soft:      #EAF2FB;
  --cc-attention:      #9A5C16;
  --cc-attention-soft: #FFF4E8;
  --cc-express:        #B8572F;
  --cc-express-soft:   #FCEFE9;
  --cc-danger:         #B3261E;
  --cc-danger-soft:    #F8E9E7;
  --cc-canvas:         #FCFAF6;
  --cc-surface:        #FFFFFF;
  --cc-text:           #1F2421;
  --cc-text-muted:     #5F6863;
  --cc-border:         #DCE5DF;
  --warm-gray:         #EDE9E2;
  --r: 14px; --rs: 10px;
  --sombra: 0 2px 10px rgba(31, 36, 33, 0.06);
  --nav-h: calc(60px + env(safe-area-inset-bottom, 0px));
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: 'DM Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px; line-height: 1.4; color: var(--cc-text); background: var(--cc-canvas);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
a { color: var(--cc-primary); }
.serif { font-family: 'DM Serif Display', Georgia, serif; font-weight: 400; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mini { font-size: 13px; color: var(--cc-text-muted); }
.muted { color: var(--cc-text-muted); }
.negrito { font-weight: 600; }
.centro { text-align: center; }
.link { background: none; border: none; padding: 8px 0; color: var(--cc-primary); font-weight: 600; cursor: pointer; text-decoration: underline; }

/* ---------- telas inteiras (login, consentimento, avisos) ---------- */
.tela-cheia {
  min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom, 0px)); background: var(--cc-canvas);
}
.tela-cheia .caixa { width: 100%; max-width: 420px; }
.marca { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 24px; }
.marca-icone {
  width: 64px; height: 64px; border-radius: 18px; background: var(--cc-primary); color: var(--cc-surface);
  display: flex; align-items: center; justify-content: center; font-size: 30px;
}
.marca-icone img { width: 42px; height: auto; display: block; }
.marca h1 { font-size: 28px; margin: 0; color: var(--cc-primary-dark); }
.marca .sub { color: var(--cc-text-muted); font-size: 14px; }
.termos { max-height: 46dvh; overflow: auto; padding: 14px; background: var(--cc-surface); border: 1px solid var(--cc-border); border-radius: var(--rs); font-size: 15px; }
.termos h3 { margin: 12px 0 4px; font-size: 15px; }
.termos ul { padding-left: 20px; margin: 6px 0; }

/* ---------- casca do app ---------- */
#app { display: flex; flex-direction: column; height: 100dvh; max-width: 760px; margin: 0 auto; background: var(--cc-canvas); position: relative; }
@media (min-width: 761px) { #app { border-left: 1px solid var(--cc-border); border-right: 1px solid var(--cc-border); } }
.topo {
  display: flex; align-items: center; gap: 8px; min-height: 56px; padding: 8px 12px;
  padding-top: calc(8px + env(safe-area-inset-top, 0px));
  background: var(--cc-surface); border-bottom: 1px solid var(--cc-border); position: sticky; top: 0; z-index: 20;
}
.topo-titulo { flex: 1; font-weight: 600; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn-icone {
  width: 44px; height: 44px; border-radius: 12px; border: none; background: none; display: inline-flex; align-items: center;
  justify-content: center; cursor: pointer; font-size: 22px; color: var(--cc-text);
}
.btn-icone:active { background: var(--cc-primary-soft); }
.conteudo { flex: 1; overflow: auto; padding: 16px 16px calc(16px + var(--nav-h)); -webkit-overflow-scrolling: touch; }

/* nav-bar: mesmo desenho do protótipo (verbatim nos itens) */
.nav-bar {
  position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: stretch; gap: 2px; padding: 4px 6px;
  padding-bottom: calc(4px + env(safe-area-inset-bottom, 0px)); height: var(--nav-h);
  background: var(--cc-surface); border-top: 1px solid var(--cc-border); z-index: 20;
}
.nav-item {
  box-sizing: border-box; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 8px; cursor: pointer;
  border: none; background: none; border-radius: 10px; transition: all .2s; flex: 1; min-height: 44px; justify-content: center; position: relative;
}
.nav-item svg { width: 22px; height: 22px; flex-shrink: 0; stroke: var(--cc-text-muted); }
.nav-item span { font-size: 11px; font-weight: 500; color: var(--cc-text-muted); line-height: 1.2; }
.nav-item.active span { color: var(--cc-primary); font-weight: 600; }
.nav-item.active svg { stroke: var(--cc-primary); }
.nav-item:active { background: var(--cc-primary-soft); }
.nav-badge { position: absolute; top: 4px; right: calc(50% - 20px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--cc-danger); color: var(--cc-surface); font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }

/* ---------- componentes ---------- */
.card { background: var(--cc-surface); border: 1px solid var(--cc-border); border-radius: var(--r); padding: 16px; margin-bottom: 12px; box-shadow: var(--sombra); }
.card-titulo { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 10px; font-size: 16px; font-weight: 600; }
.card-titulo .mini { font-weight: 400; }
.secao { margin: 20px 0 8px; font-size: 13px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--cc-text-muted); }
.hero { background: var(--cc-primary); color: var(--cc-surface); border-radius: var(--r); padding: 18px 16px; margin-bottom: 14px; }
.hero h2 { margin: 0 0 4px; font-size: 22px; }
.hero .mini { color: rgba(255, 255, 255, 0.85); }

.lista { display: flex; flex-direction: column; gap: 8px; }
.item {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: var(--cc-surface); border: 1px solid var(--cc-border);
  border-radius: var(--rs); padding: 12px 14px; min-height: 56px; cursor: pointer;
}
.item:active { border-color: var(--cc-primary); background: var(--cc-primary-soft); }
.item .texto { flex: 1; min-width: 0; }
.item .titulo { font-weight: 600; }
.item .sub { font-size: 13px; color: var(--cc-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .seta { color: var(--cc-text-muted); font-size: 20px; }
.item.estatico { cursor: default; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  background: var(--cc-primary-soft); color: var(--cc-primary-dark); font-weight: 700; font-size: 15px;
}
.avatar.info { background: var(--cc-info-soft); color: var(--cc-info); }
.avatar.warn { background: var(--cc-attention-soft); color: var(--cc-attention); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 12px 18px; border-radius: var(--rs);
  border: 1.5px solid transparent; font-weight: 600; font-size: 16px; cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--cc-primary); color: var(--cc-surface); }
.btn-primary:active, .btn-primary:hover { background: var(--cc-primary-dark); }
.btn-secondary { background: transparent; color: var(--cc-text); border-color: var(--cc-border); }
.btn-secondary:active, .btn-secondary:hover { border-color: var(--cc-primary); color: var(--cc-primary); }
.btn-danger { background: var(--cc-danger-soft); color: var(--cc-danger); border-color: var(--cc-danger-soft); }
.btn-warn { background: var(--cc-attention-soft); color: var(--cc-attention); border-color: var(--cc-attention-soft); }
.btn-block { display: flex; width: 100%; }
.btn-sm { min-height: 38px; padding: 6px 12px; font-size: 14px; }
.btn-lg { min-height: 60px; font-size: 18px; }
.acoes { display: flex; gap: 10px; margin-top: 14px; }
.acoes .btn { flex: 1; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--cc-text-muted); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 13px 14px; border: 1.5px solid var(--cc-border); border-radius: var(--rs); font-family: inherit; font-size: 16px;
  color: var(--cc-text); background: var(--cc-surface); outline: none; transition: border-color .2s; min-height: 48px;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--cc-primary); }
.field textarea { resize: vertical; min-height: 88px; }
.field .ajuda { font-size: 13px; color: var(--cc-text-muted); margin-top: 4px; }
.field.erro input, .field.erro select, .field.erro textarea { border-color: var(--cc-danger); }
.field .msg-erro { color: var(--cc-danger); font-size: 13px; margin-top: 4px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 16px; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--cc-primary); }

.chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; background: var(--warm-gray); color: var(--cc-text-muted); white-space: nowrap; }
.chip-ok { background: var(--cc-primary-soft); color: var(--cc-primary-dark); }
.chip-info { background: var(--cc-info-soft); color: var(--cc-info); }
.chip-warn { background: var(--cc-attention-soft); color: var(--cc-attention); }
.chip-danger { background: var(--cc-danger-soft); color: var(--cc-danger); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn { border: 1.5px solid var(--cc-border); background: var(--cc-surface); cursor: pointer; min-height: 36px; font-size: 14px; }
.chip-btn.sel { border-color: var(--cc-primary); background: var(--cc-primary-soft); color: var(--cc-primary-dark); }

.aviso { border-radius: var(--rs); padding: 12px 14px; margin-bottom: 12px; font-size: 15px; border: 1px solid transparent; }
.aviso-info { background: var(--cc-info-soft); color: var(--cc-info); }
.aviso-warn { background: var(--cc-attention-soft); color: var(--cc-attention); }
.aviso-danger { background: var(--cc-danger-soft); color: var(--cc-danger); }
.aviso-ok { background: var(--cc-primary-soft); color: var(--cc-primary-dark); }


.vazio { text-align: center; padding: 28px 16px; color: var(--cc-text-muted); }
.vazio .ico { font-size: 34px; margin-bottom: 6px; }

.tabs { display: flex; gap: 6px; overflow: auto; padding-bottom: 4px; margin-bottom: 12px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: 0 0 auto; border: 1.5px solid var(--cc-border); background: var(--cc-surface); border-radius: 20px; padding: 8px 14px; font-weight: 600; font-size: 14px; cursor: pointer; min-height: 40px; }
.tab.active { border-color: var(--cc-primary); background: var(--cc-primary-soft); color: var(--cc-primary-dark); }



/* toast */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 16px); transform: translateX(-50%) translateY(20px); opacity: 0;
  max-width: min(92vw, 520px); padding: 12px 16px; border-radius: var(--rs); background: var(--cc-text); color: var(--cc-surface);
  font-size: 15px; z-index: 100; transition: all .25s; pointer-events: none; box-shadow: var(--sombra);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.ok { background: var(--cc-primary-dark); }
.toast.erro { background: var(--cc-danger); }
.toast.warn { background: var(--cc-attention); }

/* modal / folha */
.modal-fundo { position: fixed; inset: 0; background: rgba(31, 36, 33, 0.45); z-index: 90; display: flex; align-items: flex-end; justify-content: center; }
.folha { width: 100%; max-width: 760px; background: var(--cc-surface); border-radius: var(--r) var(--r) 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom, 0px)); max-height: 88dvh; overflow: auto; }
.folha h3 { margin: 0 0 8px; font-size: 18px; }
.folha p { margin: 0 0 14px; color: var(--cc-text-muted); }
@media (min-width: 761px) { .modal-fundo { align-items: center; } .folha { border-radius: var(--r); max-width: 520px; } }

.carregando { text-align: center; padding: 30px; color: var(--cc-text-muted); }
.versao { text-align: center; font-size: 12px; color: var(--cc-text-muted); margin-top: 24px; }


/* ---------- marketplace: componentes novos ---------- */
.avatar.grande { width: 96px; height: 96px; font-size: 32px; }
.avatar.medio { width: 56px; height: 56px; font-size: 20px; }
.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.foto-topo { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 14px; text-align: center; }

.escolhas { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.cartao-escolha { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left; padding: 14px; min-height: 96px; border: 1.5px solid var(--cc-border); border-radius: var(--r); background: var(--cc-surface); cursor: pointer; }
.cartao-escolha .t { font-weight: 700; font-size: 16px; }
.cartao-escolha .d { font-size: 13px; color: var(--cc-text-muted); }
.cartao-escolha.sel { border-color: var(--cc-primary); background: var(--cc-primary-soft); }
.abas-login { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; }
.aba-login { min-height: 52px; border: 1.5px solid var(--cc-border); background: var(--cc-surface); border-radius: var(--rs); font-weight: 700; font-size: 16px; cursor: pointer; }
.aba-login.active { border-color: var(--cc-primary); background: var(--cc-primary); color: var(--cc-surface); }

.chip-escolha { display: inline-flex; align-items: center; gap: 6px; min-height: 48px; padding: 8px 16px; border-radius: 24px; border: 1.5px solid var(--cc-border); background: var(--cc-surface); font-size: 16px; font-weight: 600; cursor: pointer; }
.chip-escolha.sel { border-color: var(--cc-primary); background: var(--cc-primary-soft); color: var(--cc-primary-dark); }

.grid-dispo { display: grid; grid-template-columns: 52px repeat(3, 1fr); gap: 6px; align-items: center; }
.grid-dispo .cab { font-size: 13px; font-weight: 600; color: var(--cc-text-muted); text-align: center; }
.grid-dispo .dia { font-weight: 600; font-size: 15px; }
.grid-dispo label.cel { display: flex; align-items: center; justify-content: center; min-height: 48px; border: 1.5px solid var(--cc-border); border-radius: var(--rs); background: var(--cc-surface); cursor: pointer; }
.grid-dispo label.cel input { width: 24px; height: 24px; accent-color: var(--cc-primary); }
.grid-dispo .cel-ro { display: flex; align-items: center; justify-content: center; min-height: 40px; border-radius: var(--rs); background: var(--warm-gray); color: var(--cc-text-muted); font-size: 18px; }
.grid-dispo .cel-ro.on { background: var(--cc-primary-soft); color: var(--cc-primary-dark); font-weight: 700; }

.card-prof { display: flex; gap: 12px; width: 100%; text-align: left; background: var(--cc-surface); border: 1px solid var(--cc-border); border-radius: var(--r); padding: 14px; cursor: pointer; box-shadow: var(--sombra); min-height: 56px; }
.card-prof:active { border-color: var(--cc-primary); background: var(--cc-primary-soft); }
.card-prof .corpo { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.card-prof .nome { font-weight: 700; font-size: 17px; }
.card-prof .dist { font-size: 14px; color: var(--cc-primary-dark); font-weight: 600; }
.card-prof .desc { font-size: 14px; color: var(--cc-text-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.range { width: 100%; height: 48px; accent-color: var(--cc-primary); }
.ponto-novo { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--cc-danger); margin-right: 6px; }
.selo-novo { display: inline-block; padding: 2px 8px; border-radius: 12px; background: var(--cc-danger-soft); color: var(--cc-danger); font-size: 12px; font-weight: 700; margin-left: 6px; }
.faixa-previa { background: var(--cc-info-soft); color: var(--cc-info); border-radius: var(--rs); padding: 10px 14px; margin-bottom: 12px; font-weight: 600; text-align: center; }
.aviso-vinculo { background: var(--cc-attention-soft); color: var(--cc-text); border: 1px solid var(--cc-border); border-radius: var(--rs); padding: 12px 14px; margin: 14px 0; font-size: 14px; line-height: 1.5; }
.linha-info { display: flex; gap: 8px; padding: 6px 0; font-size: 15px; }
.linha-info .rot { flex: 0 0 auto; color: var(--cc-text-muted); }
.btn-fav { background: transparent; border-color: var(--cc-border); color: var(--cc-text); }
.btn-fav.sel { background: var(--cc-danger-soft); border-color: var(--cc-danger-soft); color: var(--cc-danger); }
.contador { text-align: right; font-size: 13px; color: var(--cc-text-muted); }

@media print {
  .topo, .nav-bar, .tabs, .toast, #modal { display: none !important; }
  #app { height: auto; max-width: none; border: none; }
  .conteudo { overflow: visible; padding: 0; }
  .card { break-inside: avoid; box-shadow: none; }
}
