/* ===== Método de Protección Metabólica GLP-1 — estilos ===== */
:root {
  --brand: #059669;
  --brand-600: #047857;
  --brand-700: #065f46;
  --brand-soft: #d1fae5;
  --accent: #f43f5e;
  --bg: #f6f7f5;
  --surface: #ffffff;
  --surface-2: #f1f3f0;
  --text: #14231c;
  --text-soft: #5b6b62;
  --border: #e3e7e2;
  --shadow: 0 1px 2px rgba(6, 78, 59, .06), 0 8px 24px rgba(6, 78, 59, .06);
  --radius: 18px;
  --radius-sm: 12px;
  --maxw: 720px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1512;
    --surface: #17201b;
    --surface-2: #1e2a23;
    --text: #eaf2ec;
    --text-soft: #9db3a6;
    --border: #26332b;
    --brand-soft: #133227;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.35);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
#app { max-width: var(--maxw); margin: 0 auto; min-height: 100vh; }
a { color: var(--brand-600); }

/* ===== Header / Home ===== */
.home-top { padding: calc(10px + var(--safe-top)) 12px 0; }
.home-banner {
  display: block; width: 100%; height: auto;
  border-radius: 20px; box-shadow: var(--shadow);
}
.progress-card {
  background: linear-gradient(160deg, var(--brand) 0%, var(--brand-700) 100%);
  color: #fff; border-radius: 16px; box-shadow: var(--shadow);
  padding: 14px 18px; margin: -26px 10px 0; position: relative; z-index: 2;
}
.progress-top { display: flex; justify-content: space-between; font-size: 13px; color: #eafff6; margin-bottom: 7px; font-weight: 600; }
.progress-track { height: 9px; background: rgba(255,255,255,.22); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: #eafff6; border-radius: 999px; transition: width .5s ease; }

/* ===== Lista de módulos ===== */
.content { padding: 18px 16px calc(40px + var(--safe-bottom)); }
.section-label {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px;
  color: var(--text-soft); margin: 22px 4px 10px;
}
.section-label:first-child { margin-top: 6px; }

.cards-grid {
  display: grid; grid-template-columns: 1fr; gap: 13px;
}
@media (min-width: 560px) { .cards-grid { grid-template-columns: 1fr 1fr; } }
.gcard {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; padding: 0;
  box-shadow: var(--shadow); cursor: pointer; text-align: left;
  transition: transform .12s ease, border-color .12s ease;
  display: flex; flex-direction: column; font: inherit; color: inherit;
}
.gcard:active { transform: scale(.985); }
.gcard.done { border-color: var(--brand); }
.gcard-media { position: relative; aspect-ratio: 3 / 2; background: var(--surface-2); }
.gcard-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gcard-badge {
  position: absolute; top: 10px; right: 10px;
  background: var(--brand); color: #fff; font-size: 12px; font-weight: 700;
  padding: 4px 10px; border-radius: 999px; box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.gcard-body { padding: 12px 14px 14px; }
.card-title { font-weight: 700; font-size: 15.5px; margin: 0 0 3px; }
.card-sub { font-size: 13px; color: var(--text-soft); margin: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ===== Vista de módulo ===== */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 10px;
  padding: calc(12px + var(--safe-top)) 14px 12px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.back-btn {
  border: none; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 12px; font-size: 14px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.topbar-title { font-size: 14px; font-weight: 700; color: var(--text-soft);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.module-hero {
  display: block; width: calc(100% - 32px); height: auto;
  margin: 14px 16px 0; border-radius: 18px; box-shadow: var(--shadow);
}
.module-head { padding: 18px 20px 4px; }
.module-eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .6px;
  text-transform: uppercase; color: var(--brand-600); }
.module-head h1 { font-size: 25px; line-height: 1.2; margin: 8px 0 0; font-weight: 800; }

.prose { padding: 6px 20px 8px; font-size: 16px; }
.prose h2 { font-size: 20px; font-weight: 800; margin: 26px 0 8px; line-height: 1.25; }
.prose h3 { font-size: 17px; font-weight: 700; margin: 20px 0 6px; }
.prose h4 { font-size: 15.5px; font-weight: 700; margin: 16px 0 4px; color: var(--brand-600); }
.prose p { margin: 9px 0; }
.prose strong { font-weight: 700; }
.prose hr { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* Anexos */
.attachments { padding: 8px 16px 0; }
.attach-label { font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .8px; color: var(--text-soft); margin: 18px 6px 10px; }
/* visor de PDF integrado */
.pdf-doc { margin: 0 2px 6px; }
.pdf-loading { color: var(--text-soft); font-size: 14px; text-align: center; padding: 18px 0; }
.pdf-page {
  min-height: 120px; margin-bottom: 12px;
  border-radius: 12px; overflow: hidden;
  background: var(--surface-2); border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.pdf-page canvas { display: block; }
.pdf-counter { text-align: center; color: var(--text-soft); font-size: 12px; margin: 4px 0 10px; }

/* Vídeos */
.video-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 460px) { .video-grid { grid-template-columns: 1fr; } }
.video-card { position: relative; border-radius: var(--radius-sm); overflow: hidden;
  background: #000; aspect-ratio: 16/9; cursor: pointer; border: 1px solid var(--border); }
.video-card img { width: 100%; height: 100%; object-fit: cover; opacity: .85; display: block; }
.video-card .play { position: absolute; inset: 0; display: grid; place-items: center; }
.video-card .play span { width: 46px; height: 46px; border-radius: 50%;
  background: rgba(0,0,0,.55); color: #fff; display: grid; place-items: center; font-size: 18px; }
.video-card .vlabel { position: absolute; left: 8px; bottom: 6px; color: #fff;
  font-size: 12px; font-weight: 700; text-shadow: 0 1px 3px rgba(0,0,0,.7); }
.video-card iframe { width: 100%; height: 100%; border: 0; }

/* Botões */
.btn { background: var(--brand); color: #fff; border: none; border-radius: 12px;
  padding: 13px 18px; font-size: 15px; font-weight: 700; cursor: pointer; width: 100%;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn:active { background: var(--brand-600); }
.btn-sm { width: auto; padding: 8px 14px; font-size: 13.5px; border-radius: 10px; }
.btn-ghost { background: transparent; color: inherit; border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 12px; cursor: pointer; }
.btn-link { background: var(--surface); color: var(--brand-600); border: 1px solid var(--brand);
  border-radius: 12px; padding: 14px; font-weight: 700; text-decoration: none; text-align: center;
  display: block; }

.complete-bar { padding: 22px 20px calc(40px + var(--safe-bottom)); }
.next-hint { text-align: center; color: var(--text-soft); font-size: 13px; margin-top: 14px; }

/* barra de instalação */
.install-bar {
  position: fixed; left: 12px; right: 12px; bottom: calc(12px + var(--safe-bottom));
  max-width: calc(var(--maxw) - 24px); margin: 0 auto;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
  border-radius: 14px; padding: 12px 14px; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13.5px;
}
.install-bar > div { display: flex; gap: 8px; align-items: center; }

.footer-note { text-align: center; color: var(--text-soft); font-size: 12px;
  padding: 8px 20px calc(30px + var(--safe-bottom)); }

.fade-in { animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ===== Navegação inferior ===== */
#app { padding-bottom: 74px; }
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15;
  max-width: var(--maxw); margin: 0 auto;
  display: flex; justify-content: space-around;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  border-top: 1px solid var(--border);
  padding: 8px 6px calc(8px + var(--safe-bottom));
}
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: none; border: none; cursor: pointer;
  font-size: 11.5px; font-weight: 600; color: var(--text-soft); font-family: inherit;
  padding: 4px 0; border-radius: 10px;
}
.nav-item .nav-ico { font-size: 20px; }
.nav-item.active { color: var(--brand-600); }
.nav-item.active .nav-ico { transform: scale(1.12); }

/* ===== Páginas Plan / Comunidad ===== */
.page-head { padding: calc(24px + var(--safe-top)) 20px 4px; }
.page-head h1 { font-size: 26px; font-weight: 800; margin: 0; }
.page-sub { color: var(--text-soft); margin: 4px 0 0; font-size: 14.5px; }

.streak-card {
  background: linear-gradient(160deg, var(--brand) 0%, var(--brand-700) 100%);
  color: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 20px; display: flex; align-items: center; gap: 14px;
}
.streak-num { font-size: 30px; font-weight: 800; }
.streak-label { font-size: 14px; color: #d6f5e8; }

.plan-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px; margin-bottom: 9px;
  box-shadow: var(--shadow); cursor: pointer; text-align: left;
  font: inherit; color: inherit; transition: border-color .12s ease;
}
.plan-item.done { border-color: var(--brand); background: color-mix(in srgb, var(--brand-soft) 45%, var(--surface)); }
.plan-check {
  flex: 0 0 26px; height: 26px; width: 26px; border-radius: 50%;
  border: 2px solid var(--border); display: grid; place-items: center;
  color: #fff; font-size: 14px; font-weight: 800;
}
.plan-item.done .plan-check { background: var(--brand); border-color: var(--brand); }
.plan-ico { font-size: 20px; }
.plan-label { flex: 1; font-size: 14.5px; font-weight: 600; }
.plan-item.done .plan-label { text-decoration: line-through; opacity: .75; }
.plan-link {
  display: block; text-align: right; font-size: 13px; font-weight: 700;
  margin: -4px 6px 10px; text-decoration: none;
}
.plan-nota { color: var(--text-soft); font-size: 12.5px; margin-top: 18px; text-align: center; }

.week-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.week-day {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 8px 2px; display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.week-day.today { border-color: var(--brand); background: color-mix(in srgb, var(--brand-soft) 45%, var(--surface)); }
.week-name { font-size: 10.5px; font-weight: 700; text-transform: uppercase; color: var(--text-soft); }
.week-ico { font-size: 16px; }

.comunidad-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 26px 20px; text-align: center;
}
.comunidad-emoji { font-size: 44px; }
.comunidad-card h2 { font-size: 20px; font-weight: 800; margin: 8px 0 6px; }
.comunidad-card p { color: var(--text-soft); font-size: 14.5px; margin: 0 0 16px; }
.comunidad-soon {
  background: var(--surface-2); border-radius: 12px; padding: 12px;
  font-weight: 600; color: var(--text) !important;
}
.rules-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px 18px;
}
.rules-card p { font-size: 14.5px; margin: 12px 0; }

/* ===== Progreso: pluma + peso ===== */
.pluma-card, .peso-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; text-align: center;
}
.pluma-q { font-weight: 700; font-size: 15.5px; margin: 0 0 12px; }
.day-picker { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 6px; }
.day-pick {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 0; font-size: 12px; font-weight: 700; cursor: pointer;
  color: inherit; font-family: inherit;
}
.day-pick:active { background: var(--brand-soft); border-color: var(--brand); }
.pluma-hoy { font-size: 18px; font-weight: 800; color: var(--brand-600); margin: 4px 0 14px; }
.pluma-next { font-size: 16px; margin: 4px 0 2px; }
.pluma-count { font-size: 26px; font-weight: 800; color: var(--brand-600); margin: 2px 0 8px; }
.pluma-last { color: var(--text-soft); font-size: 12.5px; margin: 0 0 10px; }
.pluma-card .btn { margin-bottom: 10px; }
.pluma-card .btn-ghost { margin-top: 4px; }

.peso-delta { font-weight: 700; font-size: 15px; margin: 0 0 10px; color: var(--brand-600); }
.peso-chart { width: 100%; height: auto; margin-bottom: 10px; }
.peso-form { display: flex; gap: 8px; margin: 6px 0 12px; }
.peso-form input {
  flex: 1; min-width: 0; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 14px; font-size: 15px; color: inherit; font-family: inherit;
}
.peso-form input:focus { outline: 2px solid var(--brand); border-color: var(--brand); }
.peso-list { border-top: 1px solid var(--border); padding-top: 4px; }
.peso-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 2px; font-size: 14px; color: var(--text-soft);
}
.peso-row strong { color: var(--text); }
.peso-del {
  background: none; border: none; color: var(--text-soft); cursor: pointer;
  font-size: 14px; padding: 4px 6px;
}

/* ===== Rutinas de entrenamiento ===== */
.cta-destaque { margin: 4px 0 8px; background: var(--brand); color: #fff !important; border-color: var(--brand); }

.semana-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px 16px; margin-bottom: 11px;
}
.semana-head { display: flex; align-items: center; gap: 10px; }
.semana-n {
  background: var(--brand); color: #fff; font-size: 11.5px; font-weight: 700;
  padding: 3px 9px; border-radius: 999px;
}
.semana-head strong { font-size: 16px; }
.semana-nota { color: var(--text-soft); font-size: 13px; margin: 8px 0 10px; }
.semana-dias { display: flex; flex-direction: column; gap: 6px; }
.semana-dia {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--surface-2); border-radius: 10px; padding: 9px 12px;
  text-decoration: none; color: inherit;
}
.sd-dia { font-size: 12.5px; font-weight: 700; color: var(--text-soft); }
.sd-rut { font-size: 13.5px; font-weight: 600; text-align: right; }

.rutina-card {
  display: flex; align-items: center; gap: 13px; text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px; margin-bottom: 10px;
}
.rutina-ico {
  flex: 0 0 46px; height: 46px; width: 46px; border-radius: 13px;
  background: var(--brand-soft); display: grid; place-items: center; font-size: 23px;
}
.rutina-body { flex: 1; min-width: 0; }
.rutina-meta { font-size: 12px; color: var(--brand-600); font-weight: 600; margin: 4px 0 0; }
.rutina-arrow { color: var(--text-soft); font-size: 22px; }

.rutina-info {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px;
}
.rutina-info div {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 12px 6px; text-align: center; display: flex; flex-direction: column; gap: 2px;
}
.rutina-info strong { font-size: 15px; }
.rutina-info span { font-size: 11.5px; color: var(--text-soft); }
.rutina-descanso {
  background: var(--brand-soft); border-radius: 12px; padding: 11px 14px;
  font-size: 13.5px; font-weight: 600; margin: 0 0 4px; text-align: center;
}

.ej-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow); padding: 12px 14px; margin-bottom: 9px;
}
.ej-card.calent { background: var(--surface-2); }
.ej-num {
  flex: 0 0 32px; height: 32px; width: 32px; border-radius: 50%;
  background: var(--brand); color: #fff; display: grid; place-items: center;
  font-weight: 800; font-size: 14px;
}
.ej-card.calent .ej-num { background: transparent; font-size: 20px; }
.ej-body { flex: 1; min-width: 0; }
.ej-nombre { font-weight: 700; font-size: 14.5px; margin: 0; }
.ej-tag {
  background: var(--brand-soft); color: var(--brand-600); font-size: 10.5px;
  font-weight: 700; padding: 2px 7px; border-radius: 999px; margin-left: 4px;
}
.ej-detalle { font-size: 12.5px; color: var(--text-soft); margin: 2px 0 0; }
.ej-play {
  flex: 0 0 38px; height: 38px; width: 38px; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand-600); border: none;
  font-size: 14px; cursor: pointer; display: grid; place-items: center;
}
.ej-video:not(:empty) {
  aspect-ratio: 16/9; border-radius: 12px; overflow: hidden;
  margin: -2px 0 12px; border: 1px solid var(--border); background: #000;
}
.ej-video iframe { width: 100%; height: 100%; border: 0; }

/* install-bar acima da nav */
.install-bar { bottom: calc(78px + var(--safe-bottom)); }
