/* Página da demonstração: dois telemóveis lado a lado (dona à esquerda, cliente à direita).
   Identidade da Razões Dev: fundo claro, verde de ação, letra Geist. */
@font-face {
  font-family: "Geist";
  src: url("/fonts/geist/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900; font-display: swap;
}

:root {
  --bg: #F6F4EF;
  --ink: #15171A;
  --muted: #6B6A66;
  --line: #E4E0D7;
  --green: #1FB866;
  --green-ink: #0E7A41;
  --owner: #2B2F36;
  --frame: #15171A;
  --font: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --phone-h: clamp(520px, calc(100dvh - 230px), 844px);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; display: flex; flex-direction: column; min-height: 100dvh;
  background: var(--bg); color: var(--ink); font: 400 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
[hidden] { display: none !important; }
button { font: inherit; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; border-radius: 8px; }

/* ---------- Barra de topo ---------- */
.bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px clamp(16px, 3vw, 28px); border-bottom: 1px solid var(--line);
}
.bar-left, .bar-right { display: flex; align-items: center; gap: 12px; min-width: 0; }
.maker img { display: block; border-radius: 50%; }
.pill {
  flex: none; padding: 3px 10px; border-radius: 999px; background: var(--ink); color: #fff;
  font-size: .72rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
}
.bar-title { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.bar-title strong { font-weight: 600; font-size: 1rem; }
.bar-title span { color: var(--muted); font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sound { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: .85rem; cursor: pointer; user-select: none; }
.sound input { accent-color: var(--green); width: 16px; height: 16px; margin: 0; }
.btn-reset {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--ink); cursor: pointer;
  font-weight: 500; font-size: .88rem; transition: border-color .15s, transform .1s;
}
.btn-reset:hover { border-color: #cfcabe; }
.btn-reset:active { transform: scale(.97); }

/* ---------- Palco com os dois telemóveis ---------- */
.switch { display: none; }
.stage {
  flex: 1; display: flex; align-items: flex-start; justify-content: center; gap: clamp(20px, 4vw, 56px);
  padding: 14px 16px 8px;
}
.device { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.device-label { margin: 0; display: flex; align-items: center; gap: 8px; font-size: .88rem; color: var(--muted); }
.tag { padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; color: #fff; }
.tag-owner { background: var(--owner); }
.tag-client { background: var(--green-ink); }
.device-hint { margin: 0; max-width: 360px; text-align: center; color: var(--muted); font-size: .82rem; }
.device-hint strong { color: var(--ink); font-weight: 600; }

.phone {
  position: relative; width: 390px; height: var(--phone-h); border-radius: 46px; padding: 11px;
  background: var(--frame); box-shadow: 0 1px 0 rgba(255, 255, 255, .06) inset, 0 30px 60px -20px rgba(21, 23, 26, .35), 0 12px 24px -12px rgba(21, 23, 26, .25);
}
.phone iframe { display: block; width: 100%; height: 100%; border: 0; border-radius: 36px; background: #fff; }

.flow { align-self: center; display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--green-ink); margin-top: -40px; }
.flow span { font-size: .75rem; text-align: center; line-height: 1.25; color: var(--muted); }

/* ---------- Avisos tipo iPhone ---------- */
.banners { position: absolute; left: 20px; right: 20px; top: 20px; z-index: 5; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.banners-global { display: none; }
.banner {
  pointer-events: auto; display: grid; grid-template-columns: 38px 1fr; gap: 4px 10px; align-items: start;
  padding: 11px 13px; border-radius: 22px; border: 0; text-align: left; cursor: pointer; width: 100%;
  background: rgba(250, 250, 250, .86); color: #111; backdrop-filter: blur(20px) saturate(1.6); -webkit-backdrop-filter: blur(20px) saturate(1.6);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .18), 0 0 0 .5px rgba(0, 0, 0, .06);
  transform-origin: top center; animation: banner-in .5s cubic-bezier(.2, .9, .25, 1.15) both;
}
.banner.out { animation: banner-out .32s ease-in both; }
.banner-icon { grid-row: span 2; width: 38px; height: 38px; border-radius: 9px; object-fit: cover; background: #fff; }
.banner-icon.wa-icon { background: #25d366; display: grid; place-items: center; }
.wa-bubble-in {
  margin: 0; max-width: 92%; padding: 10px 12px; border-radius: 4px 12px 12px 12px; background: #fff;
  box-shadow: 0 1px 1px rgba(0, 0, 0, .08); white-space: pre-wrap; line-height: 1.45;
}
.mail-body:has(.wa-bubble-in) { background: #efeae2; margin: 0 -20px; padding: 16px 20px; }
.banner-icon.mail-icon { background: linear-gradient(#3ba2ff, #1170ff) center; display: grid; place-items: center; }
.banner-top { display: flex; justify-content: space-between; gap: 8px; font-size: .74rem; color: #6e6e73; line-height: 1.3; }
.banner-top b { font-weight: 600; color: #3a3a3c; text-transform: uppercase; letter-spacing: .02em; }
.banner-text { font-size: .86rem; line-height: 1.32; }
.banner-text strong { display: block; font-weight: 600; }
.banner-text span { white-space: pre-line; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
@keyframes banner-in { from { opacity: 0; transform: translateY(-120%) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes banner-out { to { opacity: 0; transform: translateY(-60%) scale(.97); } }

/* ---------- Email simulado (no telemóvel da cliente) ---------- */
.mail {
  position: absolute; inset: 11px; z-index: 6; border-radius: 36px; overflow: hidden;
  display: flex; flex-direction: column; background: #fff; animation: mail-in .38s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes mail-in { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.mail-top { display: flex; justify-content: space-between; align-items: center; padding: 22px 18px 10px; border-bottom: 1px solid #eee; }
.mail-back { border: 0; background: none; color: #0a7aff; padding: 4px 0; cursor: pointer; font-size: .95rem; }
.mail-sim { font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: #8e8e93; border: 1px dashed #c7c7cc; padding: 2px 8px; border-radius: 999px; }
.mail-scroll { overflow: auto; padding: 16px 20px 24px; }
.mail-subject { margin: 0 0 14px; font-size: 1.2rem; line-height: 1.3; font-weight: 600; }
.mail-from { display: grid; grid-template-columns: 36px 1fr auto; gap: 10px; align-items: center; margin-bottom: 18px; }
.mail-from small { display: block; color: #8e8e93; font-size: .78rem; }
.mail-avatar { width: 36px; height: 36px; border-radius: 50%; background: #d1d1d6; }
.mail-when { color: #8e8e93; font-size: .78rem; }
.mail-body { font-size: .92rem; line-height: 1.55; color: #1c1c1e; }
.mail-body p { margin: 0 0 12px; }
.mail-body table { width: 100%; border-collapse: collapse; margin: 6px 0 16px; border: 1px solid #ececec; border-radius: 12px; overflow: hidden; }
.mail-body td { padding: 9px 12px; border-bottom: 1px solid #f0f0f0; vertical-align: top; }
.mail-body tr:last-child td { border-bottom: 0; }
.mail-body td:first-child { color: #8e8e93; width: 38%; }
.mail-foot { margin: 22px 0 0; padding-top: 12px; border-top: 1px dashed #e0e0e0; font-size: .76rem; color: #8e8e93; }

/* ---------- Faixa da Razões Dev ---------- */
.credit-bar {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px 10px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); font-size: .84rem; color: var(--muted);
}
.credit-bar a { text-decoration: none; }
.credit-bar a:hover { text-decoration: underline; }
.credit-bar strong { color: var(--ink); font-weight: 600; }
.credit-bar .wa { color: var(--green-ink); font-weight: 600; }

/* ---------- Ecrãs médios: telemóveis um pouco mais estreitos ---------- */
@media (max-width: 1000px) and (min-width: 821px) {
  .phone { width: 360px; }
  .flow { display: none; }
}

/* ---------- Telemóvel e tablets estreitos: um ecrã de cada vez ---------- */
@media (max-width: 820px) {
  body { height: 100dvh; min-height: 0; overflow: hidden; }
  .bar { padding: 8px 12px; gap: 8px; }
  .maker, .sound, .bar-title span { display: none; }
  .bar-title strong { white-space: nowrap; }
  .bar-title strong { font-size: .92rem; }
  .btn-reset { height: 34px; padding: 0 12px; font-size: .8rem; }
  .btn-reset span { display: none; }
  .btn-reset::after { content: "Recomeçar"; }
  .switch {
    display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 8px 12px 0; padding: 4px;
    border-radius: 14px; background: #ebe7de;
  }
  .switch button {
    position: relative; border: 0; border-radius: 10px; padding: 8px 6px; background: none; color: var(--muted);
    font-weight: 600; font-size: .9rem; cursor: pointer;
  }
  .switch button small { font-weight: 400; font-size: .75rem; margin-left: 4px; }
  .switch button[aria-selected="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
  .switch-dot { position: absolute; top: 7px; right: 10px; width: 8px; height: 8px; border-radius: 50%; background: #ff3b30; }
  .stage { padding: 8px 0 0; gap: 0; min-height: 0; align-items: stretch; }
  .flow, .device-label, .device-hint { display: none; }
  .device { flex: 1; min-height: 0; }
  .stage[data-active="client"] .device[data-side="owner"],
  .stage[data-active="owner"] .device[data-side="client"] { display: none; }
  .phone { width: 100%; height: 100%; border-radius: 0; padding: 0; background: none; box-shadow: none; border-top: 1px solid var(--line); }
  .phone iframe { border-radius: 0; }
  .mail { inset: 0; border-radius: 0; }
  .banners[data-banners="owner"], .banners[data-banners="client"] { display: none; }
  .banners-global { display: flex; position: fixed; left: 10px; right: 10px; top: calc(8px + env(safe-area-inset-top)); z-index: 20; }
  .credit-bar { font-size: .76rem; padding-top: 7px; padding-bottom: calc(7px + env(safe-area-inset-bottom)); }
  .credit-bar .site { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .banner, .banner.out, .mail { animation-duration: .01ms; }
}
