/* Portal de Aprovação · vértice+ */

:root {
  --bg: #FFFFFF; --ink: #111418; --muted: #646B73; --line: #E2E5E1;
  --soft: #E3F7EE; --softink: #0B7D54; --warnbg: #FDF3E4; --warnink: #8A4F08;
  --chip: #FFFFFF; --toast: #111418; --scrim: rgba(17,20,24,0.45); --field: #FFFFFF;
  --tile: #F5F6F3;
  --verde: #2FD394; --grafite: #111418;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111418; --ink: #F2F4F1; --muted: #9AA2A9; --line: #2A3038;
    --soft: #12322A; --softink: #2FD394; --warnbg: #3A2A12; --warnink: #E8A13A;
    --chip: #1B2027; --toast: #2A3038; --scrim: rgba(0,0,0,0.6); --field: #1B2027;
    --tile: #1B2027;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111418; --ink: #F2F4F1; --muted: #9AA2A9; --line: #2A3038;
  --soft: #12322A; --softink: #2FD394; --warnbg: #3A2A12; --warnink: #E8A13A;
  --chip: #1B2027; --toast: #2A3038; --scrim: rgba(0,0,0,0.6); --field: #1B2027;
  --tile: #1B2027;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font-family: 'Plus Jakarta Sans', 'Poppins', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, textarea { font-family: inherit; }
button { cursor: pointer; }
img, video { display: block; }
:focus-visible { outline: 2px solid var(--verde); outline-offset: 2px; }

.app { max-width: 480px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; position: relative; background: var(--bg); }

/* carregando / erro */
.loading, .error { min-height: 70vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; color: var(--muted); font-size: 14px; padding: 24px; text-align: center; }
.spinner { width: 28px; height: 28px; border-radius: 999px; border: 3px solid var(--line); border-top-color: var(--verde); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.error h1 { margin: 0; font-size: 18px; color: var(--ink); }
.error p { margin: 0; max-width: 300px; line-height: 21px; }

/* topo */
.topbar { position: sticky; top: 0; z-index: 5; height: 56px; display: flex; align-items: center; justify-content: space-between; padding: 0 6px 0 16px; padding-top: env(safe-area-inset-top); height: calc(56px + env(safe-area-inset-top)); border-bottom: 1px solid var(--line); background: var(--bg); }
.topbar h1 { margin: 0; font-size: 16px; font-weight: 700; }
.topbar .right { display: flex; align-items: center; gap: 2px; }
.wordmark { margin: 0; font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.wordmark span { color: var(--softink); font-size: 0.86em; position: relative; top: -0.34em; margin-left: 1px; }
.icon-btn { width: 44px; height: 44px; border: 0; background: transparent; color: var(--ink); padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; }
.icon-btn svg { width: 22px; height: 22px; }
.theme-sun { display: none; }
.is-dark .theme-sun { display: block; }
.is-dark .theme-moon { display: none; }

/* perfil */
.profile { padding: 16px 16px 12px; display: flex; flex-direction: column; gap: 12px; }
.profile-row { display: flex; align-items: center; gap: 20px; }
.stats { flex: 1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; text-align: center; }
.stats b { display: block; font-size: 18px; font-weight: 700; }
.stats span { font-size: 12px; color: var(--muted); }
.who { display: flex; flex-direction: column; gap: 2px; }
.who b { font-size: 15px; }
.who span { font-size: 14px; color: var(--muted); }
.notice { background: var(--soft); border-radius: 14px; padding: 12px 14px; display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 20px; }
.notice svg { flex-shrink: 0; width: 18px; height: 18px; color: var(--softink); margin-top: 1px; }
.demo-flag { background: var(--warnbg); color: var(--warnink); border-radius: 10px; padding: 8px 12px; font-size: 12px; font-weight: 600; }

/* avatar que pulsa e gira */
.avatar { width: 80px; height: 80px; position: relative; flex-shrink: 0; perspective: 420px; animation: av-breathe 2.4s ease-in-out infinite; }
.avatar .pulse { position: absolute; inset: 0; border-radius: 999px; border: 3px solid var(--verde); animation: av-pulse 2.4s ease-out infinite; }
.avatar .coin { position: absolute; inset: 0; transform-style: preserve-3d; animation: av-coin 9s ease-in-out infinite; }
.avatar .face { position: absolute; inset: 0; border-radius: 999px; padding: 3px; background: var(--verde); backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.avatar .face > * { width: 100%; height: 100%; border-radius: 999px; border: 3px solid var(--bg); object-fit: cover; }
.avatar .back { transform: rotateY(180deg); }
.avatar .initials, .avatar .logo { display: flex; align-items: center; justify-content: center; background: var(--grafite); color: #FFFFFF; font-weight: 700; }
.avatar .initials { font-size: 24px; }
.avatar .logo { font-size: 34px; letter-spacing: -0.02em; padding-bottom: 4px; }
.avatar .logo span { color: var(--verde); font-size: 24px; position: relative; top: -10px; margin-left: 1px; }
@keyframes av-breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04); } }
@keyframes av-pulse { 0% { transform: scale(1); opacity: .85; } 75%, 100% { transform: scale(1.32); opacity: 0; } }
@keyframes av-coin { 0%, 52% { transform: rotateY(0deg); } 60%, 84% { transform: rotateY(180deg); } 92%, 100% { transform: rotateY(360deg); } }

/* abas e grade */
.tabs { display: flex; border-top: 1px solid var(--line); }
.tab { flex: 1; height: 46px; border: 0; background: transparent; padding: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); border-bottom: 2px solid transparent; }
.tab[aria-pressed="true"] { color: var(--ink); border-bottom-color: var(--ink); }
.tab svg { width: 22px; height: 22px; }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px; min-height: 45vh; align-content: start; touch-action: pan-y; }
.tile { position: relative; aspect-ratio: 3 / 4; border: 0; padding: 0; margin: 0; overflow: hidden; background: var(--tile); width: 100%; display: block; }
.grid.reels .tile { aspect-ratio: 9 / 16; }
.tile img, .tile video { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.tile .type { position: absolute; top: 7px; right: 7px; width: 18px; height: 18px; color: #FFFFFF; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5)); }
.chip { position: absolute; left: 6px; top: 6px; font-size: 10px; font-weight: 700; padding: 3px 7px; border-radius: 999px; background: var(--chip); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,0.18); }
.chip.ok { background: var(--soft); color: var(--softink); }
.chip.adj { background: var(--warnbg); color: var(--warnink); }
.empty { grid-column: 1 / -1; padding: 48px 24px; text-align: center; color: var(--muted); font-size: 14px; line-height: 21px; }
.foot { margin: 0; padding: 28px 16px calc(32px + env(safe-area-inset-bottom)); text-align: center; font-size: 12px; color: var(--muted); }

/* post */
.topbar.post-head { justify-content: flex-start; gap: 4px; padding-left: 8px; padding-right: 8px; }
.post-head .t { display: flex; flex-direction: column; }
.post-head .t b { font-size: 15px; }
.post-head .t span { font-size: 12px; color: var(--muted); }
.author { display: flex; align-items: center; gap: 10px; padding: 10px 14px; }
.author .mini { width: 34px; height: 34px; border-radius: 999px; object-fit: cover; background: var(--grafite); color: #FFFFFF; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.author b { font-size: 14px; }
.media { position: relative; background: #000; }
.slides { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; aspect-ratio: var(--ratio, 4 / 5); }
.slides::-webkit-scrollbar { display: none; }
.slides > * { flex: 0 0 100%; width: 100%; height: 100%; object-fit: cover; scroll-snap-align: center; }
.media video { width: 100%; max-height: 78vh; aspect-ratio: 9 / 16; object-fit: contain; background: #000; }
.media .poster-only { position: relative; aspect-ratio: 9 / 16; max-height: 78vh; margin: 0 auto; }
.media .poster-only img { width: 100%; height: 100%; object-fit: cover; }
.media .play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 72px; height: 72px; border-radius: 999px; background: rgba(255,255,255,0.2); display: flex; align-items: center; justify-content: center; }
.media .play svg { width: 30px; height: 30px; }
.counter { position: absolute; top: 12px; right: 12px; font-size: 12px; font-weight: 700; padding: 4px 9px; border-radius: 999px; background: rgba(17,20,24,0.75); color: #FFFFFF; }
.arrow { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border: 0; padding: 0; background: transparent; display: flex; align-items: center; justify-content: center; }
.arrow span { width: 30px; height: 30px; border-radius: 999px; background: rgba(255,255,255,0.92); display: flex; align-items: center; justify-content: center; color: #111418; box-shadow: 0 1px 4px rgba(0,0,0,0.2); }
.arrow svg { width: 16px; height: 16px; }
.arrow.prev { left: 6px; } .arrow.next { right: 6px; }
.arrow[hidden] { display: none; }
@media (hover: none) { .arrow { display: none; } }
.actions-row { position: relative; height: 48px; display: flex; align-items: center; justify-content: space-between; padding: 0 14px; }
.actions-row .ig { display: flex; gap: 16px; }
.actions-row svg { width: 24px; height: 24px; }
.dots { position: absolute; left: 50%; transform: translateX(-50%); display: flex; gap: 4px; }
.dots i { width: 6px; height: 6px; border-radius: 999px; background: var(--line); }
.dots i.on { background: var(--softink); }
.post-body { padding: 0 14px 20px; display: flex; flex-direction: column; gap: 10px; }
.caption { margin: 0; font-size: 14px; line-height: 21px; white-space: pre-line; overflow-wrap: anywhere; }
.caption.empty-cap { color: var(--muted); font-style: italic; }
.when { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.when svg { width: 15px; height: 15px; }
.state { border-radius: 14px; padding: 12px 14px; font-size: 14px; line-height: 20px; }
.state.ok { background: var(--soft); color: var(--softink); font-weight: 600; }
.state.adj { background: var(--warnbg); }
.state.adj b { display: block; color: var(--warnink); margin-bottom: 2px; }
.bar { position: static; padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--bg); display: flex; gap: 10px; z-index: 4; }
.btn { flex: 1; height: 52px; border-radius: 999px; font-size: 15px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1.5px solid var(--ink); background: var(--bg); color: var(--ink); }
.btn svg { width: 18px; height: 18px; }
.btn.ok { background: var(--verde); border-color: var(--verde); color: #111418; }
.btn.dark { background: var(--ink); border-color: var(--ink); color: var(--bg); flex: 1.4; }
.btn.ghost { border-color: var(--line); }
.btn[disabled] { opacity: 0.4; cursor: default; }
.btn.busy { opacity: 0.6; pointer-events: none; }

/* folha de ajuste */
.sheet-scrim { position: fixed; inset: 0; background: var(--scrim); display: flex; align-items: flex-end; justify-content: center; z-index: 20; animation: fade .2s ease-out; }
.sheet { width: 100%; max-width: 480px; background: var(--bg); border-radius: 22px 22px 0 0; padding: 12px 20px calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; animation: sheet-up .25s ease-out; }
.sheet .grip { align-self: center; width: 40px; height: 4px; border-radius: 999px; background: var(--line); }
.sheet h2 { margin: 0; font-size: 19px; }
.sheet p { margin: 4px 0 0; font-size: 14px; line-height: 20px; color: var(--muted); }
.sheet label { font-size: 13px; font-weight: 600; margin-bottom: -8px; }
.sheet textarea { height: 130px; resize: none; border: 1.5px solid var(--line); border-radius: 14px; padding: 12px 14px; font-size: 16px; line-height: 22px; color: var(--ink); background: var(--field); }
.sheet textarea:focus { outline: none; border-color: var(--verde); }
.sheet .row { display: flex; gap: 10px; }
@keyframes fade { from { opacity: 0; } }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } }

/* aviso rápido */
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(24px + env(safe-area-inset-bottom)); width: calc(100% - 32px); max-width: 448px; background: var(--toast); color: #FFFFFF; border-radius: 14px; padding: 14px 16px; display: flex; align-items: center; gap: 10px; font-size: 14px; line-height: 20px; font-weight: 500; z-index: 30; animation: toast-in .25s ease-out; }
.toast svg { flex-shrink: 0; width: 20px; height: 20px; color: var(--verde); }
.toast.err svg { color: #E8A13A; }
@keyframes toast-in { from { transform: translate(-50%, 16px); opacity: 0; } }

/* comemoração */
.cel { position: fixed; inset: 0; z-index: 40; background: #111418; color: #FFFFFF; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 32px; text-align: center; overflow: hidden; }
.cel .cf { position: absolute; top: -48px; font-weight: 800; line-height: 1; animation: cf-fall linear infinite; }
.cel .check { width: 104px; height: 104px; border-radius: 999px; background: var(--verde); display: flex; align-items: center; justify-content: center; position: relative; animation: cel-pop .6s cubic-bezier(.2,1.4,.4,1) both; }
.cel .check svg { width: 52px; height: 52px; color: #111418; }
.cel h2 { margin: 0; font-size: 30px; line-height: 36px; font-weight: 800; letter-spacing: -0.02em; position: relative; }
.cel p { margin: 0; font-size: 15px; line-height: 23px; color: #C9CED3; max-width: 300px; position: relative; }
.cel .btn { flex: 0 0 auto; padding: 0 28px; margin-top: 8px; position: relative; }
.cel .up { animation: cel-up .5s ease-out both; }
.cel .wordmark { position: absolute; bottom: calc(28px + env(safe-area-inset-bottom)); color: #FFFFFF; font-size: 14px; }
.cel .wordmark span { color: var(--verde); }
@keyframes cf-fall { to { transform: translateY(110vh) rotate(400deg); } }
@keyframes cel-pop { from { transform: scale(0); } }
@keyframes cel-up { from { opacity: 0; transform: translateY(16px); } }

/* página sem cliente */
.landing { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.landing-box { max-width: 340px; text-align: center; display: flex; flex-direction: column; gap: 10px; }
.landing-box .wordmark { font-size: 22px; }
.landing-box h1 { margin: 8px 0 0; font-size: 22px; }
.landing-box p { margin: 0; color: var(--muted); line-height: 22px; }

/* ---------- versão desktop ---------- */
@media (min-width: 900px) {
  .app { max-width: 975px; padding: 0 20px; }
  .topbar { padding-left: 4px; padding-right: 0; }

  /* perfil no estilo do Instagram no computador */
  .profile { display: grid; grid-template-columns: 240px minmax(0, 1fr); column-gap: 24px; row-gap: 14px; padding: 36px 0 40px; align-items: start; }
  .profile-row { display: contents; }
  .profile .avatar { grid-column: 1; grid-row: 1 / span 4; justify-self: center; width: 150px; height: 150px; margin-top: 4px; }
  .avatar .face { padding: 4px; }
  .avatar .face > * { border-width: 4px; }
  .avatar .pulse { border-width: 4px; }
  .avatar .initials { font-size: 46px; }
  .avatar .logo { font-size: 64px; padding-bottom: 8px; }
  .avatar .logo span { font-size: 44px; top: -18px; margin-left: 2px; }
  .profile .who { grid-column: 2; grid-row: 1; flex-direction: row; align-items: baseline; gap: 14px; flex-wrap: wrap; }
  .profile .who b { font-size: 20px; }
  .profile .who span { font-size: 15px; }
  .profile .stats { grid-column: 2; grid-row: 2; display: flex; gap: 40px; text-align: left; }
  .profile .stats > div { display: flex; align-items: baseline; gap: 6px; }
  .profile .stats b { display: inline; font-size: 17px; }
  .profile .stats span { font-size: 15px; color: var(--ink); }
  .profile .demo-flag, .profile .notice { grid-column: 2; max-width: 560px; }

  /* grade */
  .tabs { justify-content: center; gap: 60px; border-top: 1px solid var(--line); }
  .tab { flex: 0 0 auto; width: 120px; border-bottom: 0; border-top: 1px solid transparent; margin-top: -1px; height: 52px; }
  .tab[aria-pressed="true"] { border-top-color: var(--ink); }
  .grid { gap: 4px; }
  .tile { border-radius: 4px; transition: filter .15s; }
  .tile:hover { filter: brightness(0.88); }
  .chip { font-size: 11px; left: 8px; top: 8px; }

  /* lista de posts: cartões centralizados, como o feed do Instagram no computador */
  .post-head { border-bottom: 1px solid var(--line); }
  .post-list { max-width: 520px; margin: 0 auto; padding: 20px 0 48px; display: flex; flex-direction: column; gap: 24px; }
  .post-layout { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
  .post-layout .media video, .media .poster-only { max-height: 82vh; }
  .tile:hover { filter: brightness(0.88); }

  /* folha de ajuste vira janela no centro */
  .sheet-scrim { align-items: center; }
  .sheet { border-radius: 22px; padding-bottom: 24px; }
  .sheet .grip { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .avatar, .avatar .pulse, .avatar .coin, .cel .cf, .cel .check, .cel .up, .sheet, .sheet-scrim, .toast { animation: none; }
}

/* lista de posts */
.post-list { display: flex; flex-direction: column; }
.post-layout { scroll-margin-top: calc(60px + env(safe-area-inset-top)); border-bottom: 8px solid var(--tile); }
.post-layout:last-child { border-bottom: 0; }
.who-mini { display: flex; flex-direction: column; line-height: 1.2; }
.who-mini span { font-size: 12px; color: var(--muted); }
.post-layout .bar { border-top: 0; padding-top: 0; }
@media (min-width: 900px) { .post-layout, .post-layout:last-child { border-bottom: 1px solid var(--line); } }
