/* ============================================================
   A CONTA DA VIDA — Área de Membros · design system
   Identidade do funil: cream / verde / dourado, Fraunces + Instrument Sans.
   Mobile-first de verdade: desktop é o caso especial.
   ============================================================ */

:root {
  --cream: #FAF6EF;
  --card: #FFFFFF;
  --ink: #26221A;
  --ink-soft: #5C5546;
  --verde: #1E4D3B;
  --verde-escuro: #143529;
  --dourado: #B8913F;
  --linha: #E8E0D0;
  --erro: #A8402F;
  --raio: 14px;
  --pad: 20px;
  --serif: 'Fraunces', Georgia, serif;
  --sans: 'Instrument Sans', system-ui, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans);
  background: var(--cream);
  color: var(--ink);
  line-height: 1.5;
  min-height: 100dvh;
}
button { font-family: inherit; cursor: pointer; }
img { max-width: 100%; display: block; }

/* ---------- botões ---------- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 52px;
  border: 0; border-radius: var(--raio);
  font-size: 17px; font-weight: 600;
  transition: transform .15s ease, background .2s ease;
}
.btn:active { transform: scale(.985); }
.btn-primary { background: var(--verde); color: #fff; }
.btn-primary:hover { background: var(--verde-escuro); }
.btn-buy { background: var(--cream); color: var(--verde); border: 1.5px solid var(--verde); margin-top: 12px; }
.btn-ghost { background: transparent; color: var(--ink-soft); border: 1.5px solid var(--linha); min-height: 46px; font-size: 15px; }
.linkish {
  background: none; border: 0; color: var(--verde);
  font-size: 15px; text-decoration: underline; text-underline-offset: 3px;
  min-height: 44px; width: 100%; margin-top: 4px;
}

/* ---------- fundo aquarela (identidade, com véu pra contraste) ---------- */
.screen, #s-app {
  background:
    linear-gradient(180deg, rgba(250, 246, 239, .30) 0%, rgba(250, 246, 239, .78) 46%, var(--cream) 88%),
    url('media/fundo.webp') top center / 100% auto no-repeat,
    var(--cream);
}

/* ---------- login ---------- */
.screen { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: var(--pad); }
.login-inner { width: 100%; max-width: 380px; text-align: center; animation: rise .5s ease both; }
.login-photo {
  width: 88px; height: 88px; object-fit: cover; border-radius: 50%;
  margin: 0 auto 14px; border: 3px solid var(--card);
  box-shadow: 0 2px 12px rgba(38, 34, 26, .12);
}
.login-brand {
  font-size: 13px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  color: var(--dourado); margin-bottom: 6px;
}
.login-h { font-family: var(--serif); font-size: 30px; font-weight: 600; line-height: 1.15; }
.login-sub { color: var(--ink-soft); font-size: 16px; margin: 10px 0 24px; }
.field { display: block; text-align: left; margin-bottom: 14px; }
.field span { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.field input {
  width: 100%; min-height: 54px; padding: 0 16px;
  font-size: 18px; font-family: inherit; color: var(--ink);
  background: var(--card); border: 1.5px solid var(--linha); border-radius: var(--raio);
}
.field input:focus { outline: 2px solid var(--verde); outline-offset: 1px; border-color: var(--verde); }
#in-code { text-align: center; letter-spacing: .35em; font-size: 24px; font-weight: 600; }

/* ---------- app shell ---------- */
#s-app { max-width: 480px; margin: 0 auto; padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
.app-head { padding: 26px var(--pad) 10px; }
.app-head h1 { font-family: var(--serif); font-size: 26px; font-weight: 600; line-height: 1.2; }
.app-head .hi { color: var(--ink-soft); font-weight: 500; }
#head-date { font-size: 13.5px; color: var(--ink-soft); margin-top: 3px; }
.view { padding: 8px var(--pad) 24px; }
.view.enter { animation: rise .35s ease both; }

/* ---------- cards ---------- */
.card {
  background: var(--card); border: 1px solid var(--linha); border-radius: var(--raio);
  padding: var(--pad); margin-bottom: 14px;
}
.eyebrow {
  font-size: 12.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
  color: var(--dourado); margin-bottom: 8px;
}

/* aba Hoje */
.card-day { padding: 24px var(--pad); }
.day-title { font-family: var(--serif); font-size: 25px; font-weight: 600; line-height: 1.2; }
.mod-tagline { font-size: 14.5px; color: var(--ink-soft); margin: 6px 0 16px; }
.card-day .player { margin-top: 4px; }
.task { border-top: 1px solid var(--linha); padding-top: 16px; margin: 18px 0; }
.task-label { font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--verde); margin-bottom: 6px; }
.day-task { font-size: 16.5px; color: var(--ink-soft); }
.card-day .btn-primary { margin-top: 6px; }

.card-day.is-done { text-align: center; padding-top: 32px; }
.done-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 54px; height: 54px; border-radius: 50%;
  background: var(--verde); color: #fff; margin-bottom: 14px;
  animation: pop .4s cubic-bezier(.34, 1.56, .64, 1) both;
}
.done-mark svg { width: 26px; height: 26px; }
.card-day.is-done .day-task { margin-bottom: 4px; }
.tomorrow { border-top: 1px solid var(--linha); margin-top: 20px; padding-top: 16px; text-align: left; }
.tomorrow-title { font-family: var(--serif); font-size: 18px; font-weight: 600; }

/* Mapa da Travessia */
.journey { background: var(--card); border: 1px solid var(--linha); border-radius: var(--raio); padding: 14px 16px 12px; }
.j-head { display: flex; justify-content: space-between; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); }
.j-head span:last-child { color: var(--verde); }
.j-mods { display: flex; gap: 10px; margin-top: 12px; }
.j-dots { display: flex; gap: 3px; }
.j-dots i { flex: 1; height: 8px; border-radius: 4px; background: var(--linha); }
.j-dots i.is-done { background: var(--verde); }
.j-dots i.is-today { background: var(--dourado); animation: hoje-respira 2.6s ease-in-out infinite; }
.j-label { display: block; text-align: center; font-size: 10.5px; font-weight: 600; color: var(--ink-soft); margin-top: 6px; }
@keyframes hoje-respira { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }

/* devolutiva do áudio ouvido */
.p-heard { display: none; align-items: center; gap: 4px; color: var(--verde); font-weight: 600; }
.p-heard svg { width: 13px; height: 13px; }
.player.heard .p-heard { display: inline-flex; }

/* player */
.player { display: flex; align-items: center; gap: 14px; background: var(--cream); border-radius: var(--raio); padding: 14px; }
.play {
  flex: 0 0 52px; width: 52px; height: 52px; border-radius: 50%;
  border: 0; background: var(--verde); color: #fff;
  display: flex; align-items: center; justify-content: center;
  transition: transform .15s ease;
}
.play:active { transform: scale(.94); }
.play svg { width: 24px; height: 24px; }
.pline { flex: 1; }
.ptrack { height: 8px; background: var(--linha); border-radius: 4px; position: relative; cursor: pointer; }
.ptrack i { display: block; height: 100%; width: 0; background: var(--verde); border-radius: 4px; }
.ptimes { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--ink-soft); margin-top: 6px; font-variant-numeric: tabular-nums; }

/* material chip dentro do dia */
.mat-chip {
  display: flex; align-items: center; gap: 12px;
  background: var(--cream); border: 1px dashed var(--dourado); border-radius: var(--raio);
  padding: 13px 15px; margin-bottom: 16px;
  color: var(--ink); text-decoration: none; min-height: 44px;
}
.mat-chip svg { color: var(--dourado); flex-shrink: 0; }
.mat-chip span { flex: 1; font-size: 15px; line-height: 1.35; }
.mat-chip small { color: var(--ink-soft); }

/* trilhas */
.track-card {
  display: block; width: 100%; text-align: left; padding: 0; overflow: hidden;
  transition: border-color .2s ease;
}
.track-card:active { border-color: var(--verde); }
.track-banner {
  width: 100%; height: 130px; object-fit: cover; object-position: center 62%;
  display: block; border-bottom: 1px solid var(--linha);
}
.track-body { display: flex; align-items: center; gap: 12px; padding: 15px 18px 17px; }
.track-body > svg { flex-shrink: 0; color: var(--ink-soft); }
.track-txt { flex: 1; }
.track-txt h3 { font-family: var(--serif); font-size: 20px; font-weight: 600; margin-bottom: 3px; }
.track-txt p { font-size: 14.5px; color: var(--ink-soft); margin-bottom: 8px; }
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12.5px; font-weight: 600; color: var(--ink-soft);
  background: var(--cream); border: 1px solid var(--linha); border-radius: 99px;
  padding: 4px 10px;
}
.tag svg { width: 13px; height: 13px; }
.tag-open { color: var(--verde); border-color: var(--verde); background: transparent; }

.back {
  display: inline-flex; align-items: center; gap: 4px;
  background: none; border: 0; color: var(--verde);
  font-size: 15px; font-weight: 600; min-height: 44px; margin-bottom: 4px;
}
.back svg { width: 18px; height: 18px; }
.track-h { font-family: var(--serif); font-size: 26px; font-weight: 600; }
.track-sub { color: var(--ink-soft); font-size: 15px; margin: 6px 0 18px; }
.mod-card h3 { font-family: var(--serif); font-size: 19px; font-weight: 600; margin-bottom: 6px; }
.mod-desc { font-size: 14.5px; color: var(--ink-soft); margin-bottom: 4px; }
.mod-card .tag { margin-top: 8px; }
.mod-card.is-soft { background: transparent; border-style: dashed; }
.lessons { list-style: none; margin-top: 12px; }
.lessons li {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 0; border-top: 1px solid var(--linha);
  font-size: 15px; min-height: 44px;
}
.lessons li small { color: var(--ink-soft); font-size: 12px; white-space: nowrap; }
.l-ic { display: flex; flex-shrink: 0; }
.l-ic svg { width: 17px; height: 17px; }
.lessons .done .l-ic { color: var(--verde); }
.lessons .open .l-ic { color: var(--dourado); }
.lessons .locked { color: var(--ink-soft); }
.lessons .locked .l-ic { color: var(--linha); }
.l-t { flex: 1; }

/* materiais */
.intro { font-size: 15.5px; color: var(--ink-soft); margin: 2px 2px 16px; }
.mat-row { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--ink); }
.mat-ic { flex-shrink: 0; color: var(--dourado); }
.mat-txt { flex: 1; }
.mat-txt strong { font-size: 16px; }
.mat-txt small { display: block; color: var(--ink-soft); font-size: 13.5px; margin-top: 2px; }
.mat-dl { text-align: center; color: var(--verde); flex-shrink: 0; }
.mat-dl small { display: block; font-size: 11.5px; font-weight: 600; }
.mat-row.is-locked { opacity: .65; }
.mat-row.is-locked .mat-ic { color: var(--ink-soft); }

/* minha conta */
.who { display: flex; align-items: center; gap: 14px; }
.who-img { width: 54px; height: 54px; border-radius: 50%; object-fit: cover; }
.who-name { font-family: var(--serif); font-size: 19px; font-weight: 600; }
.who-phone { color: var(--ink-soft); font-size: 14px; }
.list-h { font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 10px; }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 15px; min-height: 32px; }
.support { display: flex; align-items: center; gap: 13px; text-decoration: none; color: var(--ink); }
.support > svg:first-child { color: var(--verde); flex-shrink: 0; width: 26px; height: 26px; }
.support span { flex: 1; font-size: 15px; line-height: 1.4; }
.support small { color: var(--ink-soft); }
.support > svg:last-child { color: var(--ink-soft); flex-shrink: 0; }
.hint { font-size: 14px; color: var(--ink-soft); padding: 2px 6px 12px; }
.demo { margin-top: 64px; background: transparent; border-style: dashed; }
.demo .demo-note { font-size: 13.5px; color: var(--ink-soft); margin-bottom: 12px; }
.demo-btns { display: flex; gap: 10px; }
.logout {
  display: block; width: 100%; background: none; border: 0;
  color: var(--erro); font-size: 15px; font-weight: 600;
  min-height: 48px; margin-top: 6px;
}

/* ---------- tab bar ---------- */
#tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  display: flex; justify-content: center; gap: 2px;
  background: rgba(255, 255, 255, .96);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-top: 1px solid var(--linha);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
}
#tabbar button {
  flex: 1; max-width: 120px; min-height: 56px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  background: none; border: 0; border-radius: 12px;
  color: var(--ink-soft); font-size: 11.5px; font-weight: 600;
  transition: color .2s ease;
}
#tabbar button svg { width: 23px; height: 23px; }
#tabbar button.on { color: var(--verde); }

/* ---------- wa-toast (código simulado) ---------- */
#wa-toast {
  position: fixed; top: 0; left: 0; right: 0; z-index: 60;
  padding: calc(10px + env(safe-area-inset-top)) 12px 0;
  transform: translateY(-115%); transition: transform .35s cubic-bezier(.32, .72, .35, 1);
  pointer-events: none;
}
#wa-toast.on { transform: translateY(0); }
.wa-card {
  max-width: 420px; margin: 0 auto;
  background: #fff; border-radius: 14px; padding: 12px 15px;
  box-shadow: 0 6px 24px rgba(38, 34, 26, .18); border: 1px solid var(--linha);
}
.wa-head { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; color: var(--ink-soft); margin-bottom: 4px; }
.wa-dot { width: 9px; height: 9px; border-radius: 50%; background: #25D366; }
.wa-card p { font-size: 15px; }
.wa-card strong { font-size: 17px; letter-spacing: .06em; }
.wa-card small { color: var(--ink-soft); font-size: 11.5px; }

/* ---------- bottom sheet ---------- */
#sheet-wrap {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(38, 34, 26, 0); transition: background .25s ease;
  display: flex; align-items: flex-end; justify-content: center;
}
#sheet-wrap.on { background: rgba(38, 34, 26, .45); }
#sheet {
  width: 100%; max-width: 480px;
  background: var(--card); border-radius: 20px 20px 0 0;
  padding: 12px var(--pad) calc(24px + env(safe-area-inset-bottom));
  transform: translateY(100%); transition: transform .3s cubic-bezier(.32, .72, .35, 1);
}
#sheet-wrap.on #sheet { transform: translateY(0); }
.sheet-grab { width: 40px; height: 4px; border-radius: 2px; background: var(--linha); margin: 0 auto 16px; }
.sheet-h { font-family: var(--serif); font-size: 23px; font-weight: 600; margin-bottom: 14px; }
.sheet-bullets { list-style: none; margin-bottom: 18px; }
.sheet-bullets li { display: flex; gap: 10px; align-items: flex-start; font-size: 15.5px; padding: 7px 0; }
.sheet-bullets svg { width: 18px; height: 18px; color: var(--verde); flex-shrink: 0; margin-top: 2px; }
.sheet-note { font-size: 13.5px; color: var(--ink-soft); text-align: center; margin-top: 10px; }
.sheet-close {
  display: block; width: 100%; background: none; border: 0;
  color: var(--ink-soft); font-size: 15px; min-height: 48px; margin-top: 6px;
}

/* ---------- toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: calc(88px + env(safe-area-inset-bottom)); z-index: 70;
  transform: translateX(-50%) translateY(8px);
  background: var(--ink); color: var(--cream);
  font-size: 14.5px; padding: 11px 18px; border-radius: 99px;
  max-width: calc(100% - 40px); text-align: center;
  opacity: 0; transition: opacity .25s ease, transform .25s ease;
}
#toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- animações ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { transform: scale(.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }

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

/* ---------- desktop (secundário de propósito) ---------- */
.nav-brand { display: none; }

@media (min-width: 860px) {
  body { background: #F3EDE1; }

  /* tab bar vira sidebar */
  #tabbar {
    top: 0; bottom: 0; right: auto; left: 0; width: 232px;
    flex-direction: column; justify-content: flex-start; gap: 4px;
    border-top: 0; border-right: 1px solid var(--linha);
    background: var(--card);
    padding: 28px 16px;
  }
  .nav-brand { display: flex; align-items: center; gap: 10px; padding: 0 12px 24px; }
  .nav-brand img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; }
  .nav-brand span {
    font-size: 12px; font-weight: 600; letter-spacing: .12em;
    text-transform: uppercase; color: var(--dourado);
  }
  #tabbar button {
    flex: 0 0 auto; width: 100%; max-width: none; min-height: 48px;
    flex-direction: row; justify-content: flex-start; gap: 12px;
    padding: 0 12px; font-size: 15px; border-radius: 10px;
    transition: color .2s ease, background .2s ease;
  }
  #tabbar button:hover { background: var(--cream); color: var(--ink); }
  #tabbar button.on { background: var(--cream); color: var(--verde); }

  /* conteúdo centralizado no espaço restante */
  #s-app { max-width: none; margin: 0 0 0 232px; padding-bottom: 48px; min-height: 100vh; }
  .app-head, .view { max-width: 640px; margin-left: auto; margin-right: auto; }
  .app-head { padding-top: 44px; }
  .app-head h1 { font-size: 32px; }

  /* affordance de mouse */
  .track-card:hover, a.mat-row:hover, .support:hover { border-color: var(--verde); }

  /* materiais em 2 colunas */
  #v-materiais { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
  #v-materiais .intro { grid-column: 1 / -1; margin-bottom: 2px; }
  #v-materiais .card { margin-bottom: 0; height: 100%; }

  /* sheet de compra vira modal central */
  #sheet-wrap { align-items: center; padding: 24px; }
  #sheet {
    max-width: 420px; border-radius: 20px;
    padding-bottom: 24px;
    transform: translateY(14px); opacity: 0;
    transition: transform .25s ease, opacity .25s ease;
  }
  #sheet-wrap.on #sheet { transform: none; opacity: 1; }
  .sheet-grab { display: none; }

  /* toast centrado na área de conteúdo */
  #toast { left: calc(50% + 116px); bottom: 40px; }
}
