:root {
  --primary: #1B5683;
  --primary-dark: #103552;
  --bg: #F3F7FB;
  --card: #FFFFFF;
  --ink: #122638;
  --muted: #5A6D7E;
  --border: #DCE6EF;
  --green: #16A34A;
  --green-soft: #DCFCE7;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  padding-bottom: 84px;
}
h1, h2, h3 { font-family: 'Plus Jakarta Sans', system-ui, sans-serif; }

/* AUTH */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(145deg, #0E3452, #1B5683);
}
.auth-card {
  width: 100%;
  max-width: 410px;
  background: var(--card);
  border-radius: 22px;
  padding: 32px 26px;
  box-shadow: 0 26px 60px rgba(0,0,0,0.3);
}
.auth-logo { text-align: center; margin-bottom: 24px; }
.auth-logo img { margin: 0 auto 10px; }
.auth-logo h1 { font-size: 1.45rem; color: var(--primary-dark); }
.auth-logo p { font-size: 0.9rem; color: var(--muted); }
.alert-error {
  background: #FEF2F2; color: #B91C1C; border: 1px solid #FECACA;
  padding: 10px 12px; border-radius: 10px; font-size: 0.88rem; margin-bottom: 14px; font-weight: 600;
}
.auth-footer { text-align: center; margin-top: 20px; font-size: 0.86rem; color: var(--muted); }
.auth-footer a { color: var(--primary); font-weight: 700; text-decoration: none; }

/* APP HEADER */
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.app-header-left { display: flex; align-items: center; gap: 11px; min-width: 0; }
.app-avatar { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; object-position: top; border: 2px solid var(--border); flex-shrink: 0; }
.app-clinic-name { font-weight: 800; font-size: 0.96rem; color: var(--primary-dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.plan-pill {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 999px;
  margin-top: 2px;
}
.pill-free { background: #E0F2FE; color: #075985; }
.pill-pro { background: #FEF3C7; color: #92400E; }

.app-header-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.btn-chip {
  padding: 7px 12px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--primary-dark);
  font-size: 0.8rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
.btn-chip-site { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-chip-muted { font-size: 0.8rem; color: var(--muted); text-decoration: none; padding: 6px; }

/* MAIN */
.app-container {
  max-width: 780px;
  margin: 0 auto;
  padding: 18px 16px;
}
.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

/* METRICS */
.metrics-hero-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.m-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px 14px;
}
.m-card-blue { background: linear-gradient(135deg, #1B5683, #2A7BB5); color: #fff; border: none; }
.m-card-green { background: linear-gradient(135deg, #15803D, #16A34A); color: #fff; border: none; }
.m-label { display: block; font-size: 0.76rem; font-weight: 600; opacity: 0.88; margin-bottom: 4px; }
.m-value { display: block; font-size: 2rem; font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 800; line-height: 1.1; margin-bottom: 4px; }
.m-sub { font-size: 0.74rem; opacity: 0.85; }

/* DAYS BAR */
.days-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 16px;
}
.days-head { display: flex; justify-content: space-between; font-size: 0.88rem; margin-bottom: 8px; gap: 8px; }
.days-head span { font-weight: 700; color: var(--primary); }
.days-bar { height: 9px; background: #E3EDF5; border-radius: 999px; overflow: hidden; margin-bottom: 10px; }
.days-fill { height: 100%; background: linear-gradient(90deg, #22C55E, #1B5683); border-radius: 999px; }
.days-note { font-size: 0.84rem; color: var(--muted); margin-bottom: 10px; }
.btn-upgrade-inline { font-size: 0.86rem; font-weight: 700; color: var(--primary); text-decoration: none; }

/* PANEL CARD */
.panel-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 16px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.card-head h3 { font-size: 1.02rem; color: var(--primary-dark); }
.lock-badge { background: #FEF3C7; color: #92400E; font-size: 0.72rem; font-weight: 800; padding: 3px 9px; border-radius: 999px; }
.free-ok-badge { background: var(--green-soft); color: #166534; font-size: 0.72rem; font-weight: 800; padding: 3px 9px; border-radius: 999px; }

.rank-list { list-style: none; display: grid; gap: 9px; }
.rank-list li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 12px; background: var(--bg); border-radius: 10px; font-size: 0.9rem;
}
.rank-list strong { color: var(--primary-dark); }
.empty-msg { font-size: 0.88rem; color: var(--muted); }

/* LOCKED PREVIEW */
.locked-preview { position: relative; overflow: hidden; border-radius: 12px; }
.blurred { filter: blur(5px); user-select: none; pointer-events: none; opacity: 0.7; }
.locked-overlay {
  position: absolute; inset: 0;
  background: rgba(255,255,255,0.78);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 14px; gap: 10px;
}
.locked-overlay p { font-size: 0.86rem; font-weight: 600; color: var(--primary-dark); max-width: 340px; }
.btn-unlock {
  padding: 9px 16px; background: var(--primary); color: #fff; text-decoration: none;
  border-radius: 10px; font-size: 0.84rem; font-weight: 700;
}
.pro-teaser { font-size: 0.88rem; color: var(--muted); margin-bottom: 12px; }
.btn-unlock-outline {
  display: inline-block; padding: 10px 16px; border-radius: 10px;
  border: 1.5px solid var(--primary); color: var(--primary); text-decoration: none;
  font-weight: 700; font-size: 0.86rem;
}

/* FORMS */
.f-group { margin-bottom: 12px; }
.f-group label { display: block; font-size: 0.82rem; font-weight: 600; color: #2D4459; margin-bottom: 5px; }
.f-group input, .f-group select, .f-group textarea {
  width: 100%; padding: 10px 12px; border: 1.5px solid #CFDCE6; border-radius: 10px;
  font-family: inherit; font-size: 0.92rem; color: var(--ink); background: #FCFDFE;
}
.f-group input:focus, .f-group select:focus, .f-group textarea:focus { outline: none; border-color: var(--primary); background: #fff; }
.f-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn-primary-full {
  width: 100%; padding: 13px; border: none; border-radius: 11px;
  background: var(--primary); color: #fff; font-weight: 700; font-size: 0.94rem; cursor: pointer;
}
.toggle-line { display: flex; align-items: center; gap: 10px; font-size: 0.92rem; font-weight: 600; margin-bottom: 12px; cursor: pointer; }
.spec-grid-check { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.spec-check-item {
  display: flex; align-items: center; gap: 8px; padding: 9px 10px;
  background: var(--bg); border-radius: 10px; font-size: 0.86rem; font-weight: 600; cursor: pointer;
}
.review-edit-box { display: grid; gap: 6px; margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px dashed var(--border); }

/* DIVULGAR */
.helper-txt { font-size: 0.88rem; color: var(--muted); margin: 6px 0 14px; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { flex: 1; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: 10px; font-size: 0.88rem; color: var(--primary-dark); font-weight: 600; }
.btn-copy { padding: 0 16px; border: none; border-radius: 10px; background: var(--primary); color: #fff; font-weight: 700; cursor: pointer; }
.qr-card { text-align: center; }
.qr-img { width: 210px; height: 210px; margin: 12px auto 0; border-radius: 12px; border: 1px solid var(--border); }

/* PRO TAB */
.pro-hero-card { text-align: left; }
.pro-hero-card h2 { font-size: 1.45rem; color: var(--primary-dark); margin: 10px 0 8px; }
.pro-price-big { font-size: 1.1rem; color: var(--primary-dark); margin-bottom: 6px; }
.pro-price-big strong { font-size: 2.3rem; font-family: 'Plus Jakarta Sans', sans-serif; }
.pro-checklist { list-style: none; display: grid; gap: 9px; margin: 18px 0 22px; font-size: 0.92rem; }
.btn-wa-full {
  display: block; text-align: center; padding: 14px; border-radius: 12px;
  background: var(--green); color: #fff; text-decoration: none; font-weight: 800;
}

/* BOTTOM NAV */
.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  background: var(--card);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
}
.bnav-btn {
  border: none;
  background: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
}
.bnav-ic { font-size: 1.2rem; }
.bnav-btn.is-active { color: var(--primary); font-weight: 800; }

/* TOAST */
.toast {
  position: fixed;
  top: 76px; left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  background: #0F2940;
  color: #fff;
  padding: 11px 18px;
  border-radius: 12px;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 12px 30px rgba(0,0,0,0.25);
}
.toast[hidden] { display: none; }

@media (max-width: 640px) {
  .metrics-hero-grid { grid-template-columns: 1fr; }
  .f-row, .spec-grid-check { grid-template-columns: 1fr; }
  .app-clinic-name { max-width: 145px; }
}


/* OFERTAS AFILIADO NO APP PWA */
.offers-app-card { background: #FFFDF7; border-color: #EFE3BE; }
.app-offers-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.app-offer-item {
  display: flex;
  flex-direction: column;
  background: #FFFFFF;
  border: 1px solid #EAE0C2;
  border-radius: 13px;
  overflow: hidden;
  text-decoration: none;
  color: var(--ink);
}
.app-offer-item img { width: 100%; height: 115px; object-fit: cover; background: #FAF8F2; }
.app-offer-info { padding: 10px; display: flex; flex-direction: column; flex: 1; gap: 4px; }
.app-offer-badge {
  align-self: flex-start;
  font-size: 0.64rem;
  font-weight: 800;
  background: #FEF3C7;
  color: #92400E;
  padding: 2px 7px;
  border-radius: 999px;
}
.app-offer-info strong { font-size: 0.84rem; color: var(--primary-dark); line-height: 1.25; }
.app-offer-info small { font-size: 0.74rem; color: var(--muted); flex: 1; }
.app-offer-bottom { display: flex; justify-content: space-between; align-items: center; padding-top: 6px; margin-top: 4px; border-top: 1px solid #F1F5F9; }
.app-offer-price { font-size: 0.84rem; font-weight: 800; color: #15803D; }
.app-offer-go { font-size: 0.74rem; font-weight: 700; color: var(--primary); }
@media (max-width: 520px) { .app-offers-grid { grid-template-columns: 1fr; } }
