:root {
  --teal: #0d6e63;
  --teal-dark: #0a5850;
  --navy: #1e3a5f;
  --blue: #2f6690;
  --bg: #f6f8f7;
  --card-border: #dde5e2;
  --text: #16241f;
  --muted: #5b6b66;
  --white: #ffffff;

  --font-display: 'Manrope', sans-serif;
  --font-body: 'Inter', sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* ---------- TOPBAR ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.5rem;
  background: var(--white);
  border-bottom: 1px solid var(--card-border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--teal);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-icon svg { width: 22px; height: 22px; }

.brand-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.05rem;
  line-height: 1.15;
  color: var(--navy);
}

.account {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.plan-badge {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.72rem;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  white-space: nowrap;
}

.plan-badge.free {
  background: #eef2f0;
  color: var(--muted);
}

.plan-badge.pro {
  background: var(--teal);
  color: white;
}

.btn-account {
  padding: 0.5rem 1rem;
  border-radius: 8px;
  border: 1.5px solid var(--teal);
  background: white;
  color: var(--teal);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
}

.logged-area {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.avatar-btn {
  border: none;
  background: none;
  padding: 0;
  cursor: default;
  border-radius: 50%;
}

.avatar-btn.can-edit {
  cursor: pointer;
}

.avatar-btn.can-edit:hover .avatar,
.avatar-btn.can-edit:hover .avatar-img {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--teal);
  color: white;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

/* ---------- TABS NAV ---------- */

.tabs {
  display: flex;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  flex-wrap: wrap;
  background: var(--white);
  border-bottom: 1px solid var(--card-border);
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1.1rem;
  border-radius: 12px;
  border: 1.5px solid var(--card-border);
  background: var(--white);
  color: var(--blue);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  flex: 1 1 200px;
  text-align: left;
}

.tab-btn svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.tab-btn:hover {
  border-color: var(--teal);
}

.tab-btn.active {
  background: var(--teal);
  border-color: var(--teal);
  color: white;
}

.pro-tag {
  font-size: 0.62rem;
  font-weight: 800;
  background: rgba(255,255,255,0.25);
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  margin-left: 0.3rem;
}

.tab-btn:not(.active) .pro-tag {
  background: var(--teal);
  color: white;
}

/* Garante que o atributo "hidden" do HTML sempre esconda o elemento,
   mesmo quando outra regra CSS abaixo define display para essa mesma classe/id. */
[hidden] {
  display: none !important;
}

.btn-primary, .btn-secondary {
  padding: 0.75rem 1rem;
  border-radius: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  border: 1.5px solid var(--teal);
}

.btn-primary {
  background: var(--teal);
  color: white;
}

.btn-secondary {
  background: white;
  color: var(--teal);
}

.btn-block { width: 100%; }

.btn-logout {
  background: none;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 0.4rem 0.75rem;
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--muted);
  cursor: pointer;
}

.btn-logout:hover { border-color: var(--teal); color: var(--teal); }

.content {
  max-width: 1080px;
  margin: 0 auto;
  padding: 1.75rem 1.5rem 2.5rem;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.section-title {
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--navy);
  font-size: 1.4rem;
  margin: 0 0 0.4rem;
}

.section-hint {
  color: var(--muted);
  margin: 0 0 1.25rem;
  font-size: 0.92rem;
}

/* ---------- LAYOUT DA PÁGINA DE ARTIGOS (anúncios nas laterais) ---------- */

.articles-layout {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr) 180px;
  gap: 1.5rem;
  align-items: start;
}

.ad-rail {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  position: sticky;
  top: 1.5rem;
}

.ad-rail:empty { display: none; }

@media (max-width: 900px) {
  .articles-layout { grid-template-columns: minmax(0, 1fr); }
  .ad-rail {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
  }
  .ad-rail .ad-card { flex: 1 1 220px; }
}

/* ---------- NEWS GRID ---------- */

.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1.1rem;
}

.news-card {
  background: var(--white);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.news-thumb {
  height: 110px;
  background: linear-gradient(135deg, var(--teal), var(--blue));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.news-thumb svg { width: 34px; height: 34px; opacity: 0.9; }

.news-body { padding: 0.9rem 1rem 1.1rem; display: flex; flex-direction: column; gap: 0.5rem; flex: 1; }

.news-body h3 {
  font-family: var(--font-display);
  font-size: 0.98rem;
  margin: 0;
  color: var(--navy);
  line-height: 1.3;
}

.news-body p {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0;
  flex: 1;
}

.news-link {
  align-self: flex-start;
  font-size: 0.82rem;
  font-weight: 700;
  font-family: var(--font-body);
  color: var(--teal);
  background: none;
  text-decoration: none;
  border: 1.5px solid var(--teal);
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  cursor: pointer;
}

.ad-card {
  background: repeating-linear-gradient(135deg, #f0f4f2, #f0f4f2 10px, #e7ede9 10px, #e7ede9 20px);
  border: 1px dashed #b9c6c0;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1.2rem 1rem;
  min-height: 190px;
  gap: 0.3rem;
}

.ad-card .ad-tag {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--muted);
  text-transform: uppercase;
}

.ad-card p {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0;
}

.ad-card button {
  margin-top: 0.4rem;
  font-size: 0.75rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--teal);
  background: white;
  color: var(--teal);
  font-family: var(--font-display);
  font-weight: 700;
  cursor: pointer;
}

/* ---------- CALCULATOR ---------- */

.calc-card {
  background: var(--white);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 1.25rem;
  display: grid;
  gap: 1rem;
  max-width: 420px;
}

.calc-field { display: flex; flex-direction: column; gap: 0.35rem; }

.calc-field label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--navy);
}

.calc-field input {
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--card-border);
  font-size: 0.95rem;
  font-family: var(--font-body);
}

.calc-card button {
  padding: 0.7rem 1rem;
  border: none;
  border-radius: 8px;
  background: var(--teal);
  color: white;
  font-family: var(--font-display);
  font-weight: 700;
  cursor: pointer;
}

.calc-result {
  margin-top: 1.1rem;
  background: var(--white);
  border: 1.5px solid var(--teal);
  border-radius: 12px;
  padding: 1rem 1.2rem;
  max-width: 420px;
  color: var(--navy);
  font-size: 0.95rem;
  line-height: 1.6;
}

.calc-result strong { color: var(--teal-dark); }

/* ---------- PROTOCOL LIST ---------- */

.protocol-list { display: grid; gap: 0.75rem; }

.protocol-item {
  background: var(--white);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  overflow: hidden;
}

.protocol-item summary {
  padding: 0.9rem 1.1rem;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--navy);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.protocol-item summary::-webkit-details-marker { display: none; }

.protocol-item summary::after {
  content: "+";
  color: var(--teal);
  font-size: 1.2rem;
  font-weight: 700;
}

.protocol-item[open] summary::after { content: "–"; }

.protocol-item .protocol-body {
  padding: 0 1.1rem 1rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.protocol-item.locked summary {
  color: var(--muted);
  cursor: default;
}

.protocol-item.locked summary::after { content: "🔒"; font-size: 0.9rem; }

.protocol-item .locked-inline {
  padding: 0 1.1rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.protocol-item .locked-inline p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.protocol-item .locked-inline button {
  font-size: 0.78rem;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--teal);
  background: white;
  color: var(--teal);
  font-family: var(--font-display);
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

/* ---------- CHAT ---------- */

#tab-duvidas.tab-panel.active {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.chat-container {
  max-width: 640px;
  width: 100%;
  display: flex;
  flex-direction: column;
  text-align: left;
}

.messages {
  min-height: 280px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.msg {
  padding: 0.6rem 0.9rem;
  border-radius: 12px;
  max-width: 80%;
  line-height: 1.4;
  font-size: 0.92rem;
}

.msg.user {
  align-self: flex-end;
  background: var(--teal);
  color: white;
}

.msg.bot {
  align-self: flex-start;
  background: var(--white);
  border: 1px solid var(--card-border);
  color: var(--text);
}

.msg.bot p { margin: 0 0 0.5rem; }
.msg.bot p:last-child { margin-bottom: 0; }
.msg.bot ul { margin: 0 0 0.5rem; padding-left: 1.1rem; }
.msg.bot ul:last-child { margin-bottom: 0; }
.msg.bot li { margin-bottom: 0.2rem; }
.msg.bot strong { color: var(--teal-dark); }

.chat-form {
  display: flex;
  gap: 0.5rem;
}

.chat-form input {
  flex: 1;
  padding: 0.7rem 0.9rem;
  border-radius: 8px;
  border: 1px solid var(--card-border);
  font-size: 0.95rem;
  font-family: var(--font-body);
}

.chat-form button {
  padding: 0.7rem 1.2rem;
  border: none;
  border-radius: 8px;
  background: var(--teal);
  color: white;
  font-family: var(--font-display);
  font-weight: 700;
  cursor: pointer;
}

.chat-form button:disabled { opacity: 0.6; cursor: not-allowed; }

/* ---------- FOOTER ---------- */

footer {
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
  padding: 1.2rem;
  border-top: 1px solid var(--card-border);
}

/* ---------- RESPONSIVE ---------- */

@media (max-width: 640px) {
  .tabs { padding: 0.85rem; gap: 0.5rem; }
  .tab-btn { flex: 1 1 45%; font-size: 0.8rem; padding: 0.7rem 0.6rem; }
  .content { padding: 1.25rem 1rem 2rem; }
}

/* focus visibility */
button:focus-visible, input:focus-visible, summary:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---------- CHAT BLOQUEADO (não assinante) ---------- */

.locked-box {
  max-width: 420px;
  margin: 0 auto 1.5rem;
  background: var(--white);
  border: 1.5px dashed var(--card-border);
  border-radius: 14px;
  padding: 1.5rem;
  text-align: center;
}

.locked-box p {
  color: var(--muted);
  margin: 0 0 1rem;
  font-size: 0.92rem;
}

/* ---------- PAYWALL OVERLAY ---------- */

.paywall-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 25, 22, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  z-index: 50;
}

.paywall-card {
  position: relative;
  background: var(--white);
  border-radius: 18px;
  padding: 2.25rem 2rem 1.75rem;
  max-width: 400px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 50px rgba(10, 40, 35, 0.3);
}

.paywall-card .brand-icon {
  margin: 0 auto 1rem;
  width: 50px;
  height: 50px;
}

.paywall-close {
  position: absolute;
  top: 0.75rem;
  right: 0.9rem;
  background: none;
  border: none;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
}

#paywall-title {
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--navy);
  font-size: 1.2rem;
  margin: 0 0 0.5rem;
}

#paywall-text {
  color: var(--muted);
  font-size: 0.88rem;
  margin: 0 0 1rem;
  line-height: 1.5;
}

.paywall-benefits {
  list-style: none;
  padding: 0;
  margin: 0 0 1.4rem;
  display: grid;
  gap: 0.5rem;
  text-align: left;
}

.paywall-benefits li {
  font-size: 0.85rem;
  color: var(--text);
  padding-left: 1.4rem;
  position: relative;
}

.paywall-benefits li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--teal);
  font-weight: 700;
}

.paywall-fineprint {
  margin: 0.9rem 0 0;
  font-size: 0.72rem;
  color: var(--muted);
}

/* ---------- PÁGINA DE ARTIGO (artigo.html) ---------- */

.article-ad {
  min-height: 130px;
  margin: 0 0 1.5rem;
}

.article-page {
  max-width: 680px;
}

.back-link {
  display: inline-block;
  margin-bottom: 1.25rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--teal);
  text-decoration: none;
}

.back-link:hover { text-decoration: underline; }

#article-content h1 {
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--navy);
  font-size: 1.5rem;
  line-height: 1.3;
  margin: 0 0 1.1rem;
}

#article-content p {
  color: var(--text);
  font-size: 0.97rem;
  line-height: 1.7;
  margin: 0 0 1.5rem;
  #article-content ul {
  margin: 0 0 1.5rem;
  padding-left: 1.3rem;
}

#article-content li {
  color: var(--text);
  font-size: 0.97rem;
  line-height: 1.7;
  margin-bottom: 0.4rem;
}

#article-content strong {
  color: var(--navy);
}
}

.ad-remove-link {
  margin-top: 0.4rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--teal);
  text-decoration: none;
  border: 1px solid var(--teal);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
}
