:root {
  --green: #0b7a4b;
  --green-d: #08633d;
  --mint: #e8f6ee;
  --cream: #f3efe6;
  --ink: #1c2b24;
  --muted: #6b7c74;
  --line: #d7e3db;
  --mine: #d9f4e4;
  --theirs: #ffffff;
  --bad: #c0392b;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0;
  height: 100%;
  height: 100dvh;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: #d9e8df;
  color: var(--ink);
}
button, input, textarea, select { font: inherit; color: inherit; }
#gate[hidden], #app[hidden], [hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

.gate {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 20px;
  background: linear-gradient(var(--green) 0 120px, #eef5f0 120px);
}
.gate-card {
  width: min(400px, 100%);
  background: #fff;
  border-radius: 16px;
  padding: 24px 18px;
  box-shadow: 0 10px 30px rgba(0,0,0,.08);
}
.logo { display: block; width: 140px; margin: 0 auto 10px; }
.eyebrow { text-align: center; color: var(--green); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.gate-card h1 { text-align: center; font-size: 20px; margin: 8px 0; }
.muted { color: var(--muted); line-height: 1.4; }
#login-box { display: grid; gap: 8px; margin-top: 14px; }
#login-box input {
  width: 100%; border: 1px solid var(--line); border-radius: 10px;
  padding: 12px; font-size: 16px; background: #fff;
}
#btn-login, .ok {
  border: 0; background: var(--green); color: #fff; border-radius: 10px;
  padding: 12px; font-weight: 600; min-height: 46px;
}
.error { color: var(--bad); font-size: 13px; }

.phone {
  width: min(460px, 100%);
  height: 100%;
  height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: var(--cream);
  box-shadow: 0 0 0 1px rgba(0,0,0,.06);
}
.ph-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px calc(10px + env(safe-area-inset-top));
  padding-top: max(10px, env(safe-area-inset-top));
  background: var(--green);
  color: #fff;
  flex-shrink: 0;
}
.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: #fff; color: var(--green);
  display: grid; place-items: center; font-weight: 800;
  flex-shrink: 0;
}
.who { flex: 1; min-width: 0; }
.who strong { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who span { font-size: 12px; opacity: .9; }
.dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: #7dffa3; margin-right: 4px;
}
.head-btn {
  width: 40px; height: 40px; border: 0; border-radius: 50%;
  background: rgba(255,255,255,.15); color: #fff; font-size: 16px;
}

.ph-body { flex: 1; min-height: 0; overflow: auto; -webkit-overflow-scrolling: touch; }
.ph-msgs {
  min-height: 100%;
  padding: 14px 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bubble {
  max-width: 88%;
  padding: 10px 12px;
  border-radius: 14px;
  line-height: 1.4;
  white-space: pre-wrap;
  font-size: 15px;
}
.bubble.bot { background: var(--theirs); align-self: flex-start; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.bubble.me { background: var(--mine); align-self: flex-end; }
.bubble audio { width: 100%; max-width: 240px; margin-top: 6px; }
.bubble img.shot { max-width: 220px; width: 100%; border-radius: 10px; display: block; }
.quote {
  align-self: stretch;
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
.quote header {
  padding: 8px 10px;
  background: var(--mint);
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}
.quote table { width: 100%; border-collapse: collapse; font-size: 13px; }
.quote th, .quote td { text-align: left; padding: 7px 8px; border-top: 1px solid var(--line); }
.tag { font-size: 11px; }
.tag.alto { color: var(--green); }
.tag.nenhum, .tag.baixo { color: var(--bad); }

.ph-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px calc(10px + env(safe-area-inset-bottom));
  background: #fff;
  border-top: 1px solid #eee;
  flex-shrink: 0;
}
.round {
  width: 44px; height: 44px; min-width: 44px;
  border: 1px solid #e6e6e6; border-radius: 50%;
  background: #fff; font-size: 18px;
}
.round.send { background: var(--green); color: #fff; border: 0; }
.ph-foot input[type=text] {
  flex: 1; min-width: 0;
  border: 1px solid #e6e6e6; border-radius: 22px;
  padding: 11px 14px; font-size: 16px; background: #fafafa;
}
.ph-foot.rec { color: var(--bad); background: #fff5f5; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--bad); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .35; } }
#rec-hint { flex: 1; font-size: 14px; }
.txt { border: 0; background: transparent; color: var(--ink); padding: 8px; }

.emoji-box {
  display: flex; flex-wrap: wrap; gap: 2px;
  padding: 8px; background: #fff; border-top: 1px solid #eee;
  max-height: 130px; overflow: auto;
}
.emoji-box button { border: 0; background: transparent; font-size: 22px; width: 36px; height: 36px; }

.review-wrap { padding: 12px; }
.card { background: #fff; border-radius: 12px; padding: 12px; margin: 0 0 10px; }
.card h3 { margin: 0 0 6px; font-size: 15px; }
.actions { display: flex; gap: 8px; margin-top: 8px; }
.bad { background: #7f1d1d; color: #fff; border: 0; border-radius: 8px; padding: 10px 12px; }
.preview { max-width: 100%; max-height: 200px; border-radius: 8px; }

@media (min-width: 720px) {
  body { padding: 16px 0; }
  .phone {
    height: calc(100dvh - 32px);
    border-radius: 18px;
    overflow: hidden;
  }
}

/* --- correcao/aprendizado na Revisao (v11) --- */
.tag-ap { font-size: 11px; background: #1d7a4f; color: #fff; padding: 1px 6px; border-radius: 8px; }
b.sem { color: #b3261e; }
button.fix { font-size: 11px; padding: 2px 8px; margin-left: 4px; border: 1px solid #cfc8b8; background: #fff; border-radius: 8px; cursor: pointer; }
.fixbox { margin: 8px 0 4px; padding: 8px; background: #fbf7ee; border: 1px solid #e4dcc9; border-radius: 10px; }
.fixbox .fixq { width: 100%; padding: 8px; border: 1px solid #cfc8b8; border-radius: 8px; font-size: 14px; margin-bottom: 6px; }
.fixres { display: flex; flex-direction: column; gap: 4px; max-height: 240px; overflow-y: auto; }
button.fixpick { text-align: left; padding: 7px 9px; border: 1px solid #dfd7c4; background: #fff; border-radius: 8px; font-size: 13px; cursor: pointer; }
button.fixpick:hover { background: #eef7f1; border-color: #1d7a4f; }
button.fixcancel { margin-top: 6px; font-size: 12px; background: none; border: none; color: #6b6353; text-decoration: underline; cursor: pointer; }
details.aprend { margin: 0 0 10px; padding: 8px 10px; background: #f3f7f4; border: 1px solid #d8e5dc; border-radius: 10px; }
details.aprend summary { cursor: pointer; font-weight: 600; font-size: 13px; }
details.aprend ul { margin: 8px 0 0; padding-left: 18px; font-size: 13px; }
details.aprend li { margin-bottom: 4px; }
button.forget { font-size: 11px; padding: 1px 7px; border: 1px solid #e0b4b0; background: #fff; color: #b3261e; border-radius: 8px; cursor: pointer; }

/* --- bolha de audio (v15) --- */
.audio-row { display: flex; align-items: center; gap: 8px; }
.bubble audio { width: 200px; max-width: 100%; margin: 0; height: 34px; }
.audio-dur { font-size: 12px; opacity: .7; white-space: nowrap; }
.audio-txt { margin-top: 6px; font-size: 13px; font-style: italic; opacity: .85; }
