/* Colores sacados del logo de Ciclo Cero: granate, dorado y verde petróleo. */
/* Marca Ciclo Cero: naranja, crema y negro, con el mandala de acento. */
:root {
  --bg: #F7F1E9;
  --surface: #FFFDFA;
  --soft: #F1E6D8;
  --line: #E6D8C6;
  --ink: #1D1A18;
  --muted: #6E645C;
  --wine: #E0601C;        /* naranja Ciclo Cero (acento principal) */
  --wine-ink: #FFFFFF;
  --gold: #C9631F;        /* naranja oscuro para etiquetas */
  --teal: #1D1A18;
  --ok: #2F6B4F;
  --ok-bg: #E3F0E8;
  --warn: #9A4A0C;
  --warn-bg: #FCE9D8;
  --info: #3D4A4C;
  --info-bg: #E8ECEC;
  --display: "Playfair Display", "Didot", "Bodoni 72", Georgia, serif;
  --label: "Montserrat", "Avenir Next", system-ui, sans-serif;
  --body: "Nunito Sans", "Avenir", system-ui, -apple-system, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171412;
    --surface: #211C19;
    --soft: #2B2420;
    --line: #3A302A;
    --ink: #F4ECE3;
    --muted: #B3A69B;
    --wine: #F2783A;
    --wine-ink: #171412;
    --gold: #F2964F;
    --teal: #F4ECE3;
    --ok: #8FCDA9;
    --ok-bg: #20352A;
    --warn: #F2B27A;
    --warn-bg: #3A2716;
    --info: #C9D3D4;
    --info-bg: #283032;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15.5px/1.6 var(--body); }
[hidden] { display: none !important; }
img { max-width: 100%; }
h1, h2, h3 { font-family: var(--display); margin: 0; line-height: 1.2; text-wrap: balance; }
h1 { font-size: clamp(28px, 4.4vw, 40px); font-weight: 700; color: var(--ink); letter-spacing: -.01em; }
h1 em { font-style: normal; color: var(--wine); }
h2 { font-size: 20px; font-weight: 700; color: var(--ink); }
h3 { font-size: 16.5px; font-weight: 600; font-family: var(--body); }
p { margin: 0; }
a { color: var(--wine); }
.muted { color: var(--muted); }
.eyebrow { font: 600 11.5px var(--label); letter-spacing: .22em; text-transform: uppercase; color: var(--gold); }
.lead { color: var(--muted); max-width: 62ch; }
h1 + .lead { margin-top: 16px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--wine); color: var(--wine-ink); border: 0; border-radius: 10px;
  padding: 11px 18px; font: 700 14.5px var(--body); text-decoration: none; cursor: pointer;
}
.btn:disabled { opacity: .6; cursor: default; }
.btn.ghost { background: transparent; color: var(--wine); border: 1px solid var(--line); }
.link { background: none; border: 0; color: var(--muted); font: 600 14px var(--body); cursor: pointer; padding: 4px 0; text-decoration: underline; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* Entrada */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.gate-card {
  width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 18px; padding: 32px 28px; display: flex; flex-direction: column; gap: 10px;
}
.gate-logo { width: 190px; height: 190px; border-radius: 50%; align-self: center; margin: -8px 0 0; }
.gate-card h1 em { font-style: normal; color: var(--wine); }
.gate-card .tagline { text-align: center; font: 600 11px var(--label); letter-spacing: .3em; color: var(--muted); margin-top: -4px; }
.gate-card h1 { text-align: center; font-size: 24px; }
.gate-card > p.muted { text-align: center; margin-bottom: 10px; }
.gate-card label { font-weight: 700; font-size: 13.5px; margin-top: 4px; }
input, textarea {
  width: 100%; border: 1px solid var(--line); background: var(--bg); color: var(--ink);
  border-radius: 10px; padding: 11px 12px; font: inherit;
}
.gate-card .btn { margin-top: 10px; }
.error { color: #B3261E; font-size: 14px; min-height: 1em; }
@media (prefers-color-scheme: dark) { .error { color: #F2B8B5; } }

/* Estructura */
.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.side {
  border-right: 1px solid var(--line); padding: 24px 14px; display: flex; flex-direction: column; gap: 18px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.brand img { width: 36px; height: 36px; border-radius: 50%; }
.brand span { font: 700 21px var(--display); color: var(--ink); }
.brand span em { font-style: normal; color: var(--wine); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-btn {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 0; background: none;
  color: var(--muted); font: 600 14.5px var(--body); border-radius: 10px; cursor: pointer; text-align: left;
}
.nav-btn svg { width: 20px; height: 20px; flex: none; }
.nav-btn:hover { background: var(--soft); color: var(--ink); }
.nav-btn[aria-current="page"] { background: var(--soft); color: var(--wine); }
.side-foot { margin-top: auto; padding: 14px 10px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; font-size: 13.5px; color: var(--muted); }
.side-foot b { color: var(--ink); font-size: 14.5px; }
.side-foot .link { align-self: flex-start; margin-top: 6px; }
main { padding: 36px 44px 100px; width: 100%; max-width: 1040px; }
.view { display: flex; flex-direction: column; gap: 24px; }
.mob-head { display: none; }
.bottom { display: none; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  main { padding: 16px 16px 120px; }
  .mob-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
  .mob-head .brand { padding: 0; }
  .bottom {
    display: grid; grid-template-columns: repeat(8, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
    background: var(--surface); border-top: 1px solid var(--line); padding: 6px 2px calc(6px + env(safe-area-inset-bottom, 0px));
  }
  .bottom .nav-btn { flex-direction: column; gap: 3px; font-size: 10px; padding: 6px 2px; text-align: center; justify-content: center; }
}

/* Piezas */
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 700px) { .grid2 { grid-template-columns: 1fr; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 22px; display: flex; flex-direction: column; gap: 10px; }
.card .btn { align-self: flex-start; margin-top: 4px; }
.card.feature { background: var(--wine); border-color: var(--wine); color: var(--wine-ink); background-image: radial-gradient(circle at 105% -10%, rgba(255,255,255,.22) 0 28%, transparent 28.5%), radial-gradient(circle at 105% -10%, transparent 0 36%, rgba(255,255,255,.14) 36.5% 38%, transparent 38.5%); }
.card.feature .eyebrow, .card.feature h2, .card.feature p { color: var(--wine-ink); }
.card.feature .btn { background: var(--wine-ink); color: var(--wine); }
.big { font: 700 30px/1.1 var(--display); }

.progress { display: flex; flex-direction: column; gap: 8px; }
.bar { height: 8px; border-radius: 99px; background: var(--soft); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--gold); border-radius: 99px; }
.card.feature .bar { background: rgba(255,255,255,.25); }
.card.feature .bar i { background: var(--wine-ink); }
.num { font-variant-numeric: tabular-nums; }

.pill { font: 700 12px var(--body); padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.pill.Corregido { background: var(--ok-bg); color: var(--ok); }
.pill.Completado, .pill.En-Proceso { background: var(--info-bg); color: var(--info); }
.pill.Pendiente { background: var(--warn-bg); color: var(--warn); }

.list { display: flex; flex-direction: column; }
.row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 4px;
  border-top: 1px solid var(--line); background: none; border-left: 0; border-right: 0; border-bottom: 0;
  width: 100%; text-align: left; color: inherit; font: inherit; cursor: pointer;
}
.row:first-child { border-top: 0; }
.row:hover h3 { color: var(--wine); }
.row .sub { font-size: 13.5px; color: var(--muted); }

details.session { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 4px 20px; }
details.session summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0;
}
details.session summary::-webkit-details-marker { display: none; }
details.session summary h2 { font-size: 18px; }
details.session[open] summary { border-bottom: 1px solid var(--line); }
details.session .list { padding-bottom: 6px; }

/* Lector de informes */
.back { align-self: flex-start; }
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); }
.tab { background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 14px; font: 700 14.5px var(--body); color: var(--muted); cursor: pointer; }
.tab[aria-selected="true"] { color: var(--wine); border-color: var(--wine); }
.doc { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 28px clamp(18px, 4vw, 44px); }
.doc > * { max-width: 68ch; }
.doc h1 { font-size: 24px; margin: 28px 0 10px; color: var(--wine); }
.doc h2 { font-size: 19px; margin: 22px 0 8px; color: var(--ink); font-family: var(--body); font-weight: 800; }
.doc h3 { font-size: 16px; margin: 18px 0 6px; }
.doc p { margin: 0 0 10px; }
.doc ul { margin: 0 0 12px; padding-left: 22px; }
.doc li { margin: 2px 0; }
.doc blockquote { margin: 0 0 12px; padding: 10px 14px; border-left: 3px solid var(--gold); background: var(--soft); border-radius: 0 10px 10px 0; }
.doc hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
.doc > :first-child { margin-top: 0; }
.doc.answers h3 { color: var(--muted); font-weight: 600; }

/* Asesorías */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 22px 1fr; gap: 14px; }
.timeline .dot { position: relative; }
.timeline .dot::before { content: ""; position: absolute; left: 10px; top: 0; bottom: 0; width: 2px; background: var(--line); }
.timeline li:first-child .dot::before { top: 10px; }
.timeline li:last-child .dot::before { bottom: auto; height: 10px; }
.timeline .dot::after { content: ""; position: absolute; left: 4px; top: 4px; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line); }
.timeline li.done .dot::after { background: var(--ink); border-color: var(--ink); }
.timeline li.next .dot::after { background: var(--wine); border-color: var(--wine); box-shadow: 0 0 0 4px color-mix(in srgb, var(--wine) 22%, transparent); }
.timeline .body { padding-bottom: 22px; display: flex; flex-direction: column; gap: 2px; }
.timeline .when { font-size: 14px; color: var(--muted); }
.embed { width: 100%; height: 720px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }

/* Vídeos */
.modules { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 560px) { .modules { grid-template-columns: 1fr; } }
.module { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; text-decoration: none; color: inherit; }
.module img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.module > span { padding: 12px 14px 8px; font-weight: 700; line-height: 1.35; }
.module small { display: block; padding: 0 14px 14px; color: var(--muted); font-size: 13.5px; margin-top: -6px; }
.module:hover span { color: var(--wine); }

/* Pregúntame */
.options { display: flex; flex-direction: column; gap: 8px; max-width: 560px; }
.option {
  text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px;
  font: 600 15px var(--body); color: var(--ink); cursor: pointer;
}
.option:hover { border-color: var(--wine); color: var(--wine); }
.answer { max-width: 640px; }
.answer .actions { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.answer .actions div { display: grid; grid-template-columns: 10px 1fr; gap: 12px; }
.answer .actions div::before { content: ""; width: 8px; height: 8px; margin-top: 9px; border-radius: 50%; background: var(--gold); }
.badge { align-self: flex-start; background: var(--soft); color: var(--gold); font: 700 12.5px var(--body); padding: 4px 10px; border-radius: 999px; }

.note { font-size: 14px; color: var(--muted); border-left: 3px solid var(--line); padding-left: 12px; }
.loading { color: var(--muted); padding: 40px 0; }
@media (prefers-reduced-motion: no-preference) { .view { animation: fade .2s ease; } }
@keyframes fade { from { opacity: .4; } to { opacity: 1; } }

/* Tests en el portal */
.doc.form > * { max-width: 72ch; }
.question { margin: 18px 0 22px; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg); display: flex; flex-direction: column; gap: 10px; }
.q-title { font-weight: 700; }
.q-title b { font-weight: 700; }
.q-hint { color: var(--muted); font-size: 14.5px; }
.q-hint p, .q-hint ul { margin: 0 0 4px; }
.text-input, .note-input { resize: vertical; background: var(--surface); }
.scale { display: grid; grid-template-columns: repeat(11, minmax(0, 1fr)); gap: 4px; }
.scale-btn {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 8px;
  padding: 9px 0; font: 700 14px var(--body); cursor: pointer; font-variant-numeric: tabular-nums;
}
.scale-btn[aria-pressed="true"] { background: var(--wine); border-color: var(--wine); color: var(--wine-ink); }
.scale-legend { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); }
.choices { display: flex; flex-direction: column; gap: 6px; }
.choice, .todo { display: flex; gap: 10px; align-items: flex-start; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; }
.choice input, .todo input { margin-top: 4px; accent-color: var(--wine); width: auto; }
.todo { margin: 0 0 6px; }
.saved { font-size: 13px; color: var(--muted); min-height: 1em; }
.submit-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.status-ok { background: var(--ok-bg); border-color: transparent; color: var(--ok); }
.doc figure { margin: 0 0 14px; }
.doc figure img { border-radius: 10px; }
.doc figcaption { font-size: 13px; color: var(--muted); }
.doc-link { font-weight: 700; }
@media (max-width: 480px) { .scale-btn { padding: 8px 0; font-size: 13px; } .question { padding: 14px; } }

/* Gráfico de avance (Mi programa) */
.overview { flex-direction: row; align-items: center; gap: 28px; flex-wrap: wrap; }
.overview-side { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 8px; }
.donut { flex: none; }
.donut-bg { fill: none; stroke: var(--soft); stroke-width: 12; }
.donut-fg { fill: none; stroke: var(--wine); stroke-width: 12; stroke-linecap: round; }
.donut-num { font: 700 26px var(--display); fill: var(--ink); }
.donut-lbl { font: 600 10px var(--label); letter-spacing: .12em; text-transform: uppercase; fill: var(--muted); }
.sbar { display: grid; grid-template-columns: 70px 1fr 42px; align-items: center; gap: 10px; font-size: 13.5px; }
.sbar b { text-align: right; color: var(--muted); }
.sbar .bar i { background: var(--wine); }

/* Mi camino */
.journey { gap: 14px; }
.journey-pct { display: flex; align-items: baseline; gap: 10px; }
.track { position: relative; height: 14px; border-radius: 99px; background: var(--soft); margin: 26px 8px 4px; }
.track-fill { position: absolute; inset: 0 auto 0 0; border-radius: 99px; background: linear-gradient(90deg, var(--gold), var(--wine)); }
.track .tick { position: absolute; top: 3px; width: 2px; height: 8px; background: var(--surface); opacity: .7; transform: translateX(-1px); }
.track .tick:last-child { display: none; }
.track .you { position: absolute; top: 50%; width: 26px; height: 26px; border-radius: 50%; background: var(--surface); border: 4px solid var(--wine); transform: translate(-50%, -50%); }
.track .you b { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); margin-bottom: 6px; font: 700 12px var(--label); color: var(--wine); }
.ends { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.ends .b { text-align: right; }
.end-tag { font: 700 11.5px var(--label); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.ends p { margin-top: 4px; font-size: 14.5px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 900px) { .grid3 { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .ends { grid-template-columns: 1fr; } .ends .b { text-align: left; } }
.clist { margin: 4px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.clist li::marker { color: var(--wine); }

/* Vídeos dentro del portal */
.embed.videos { height: calc(100vh - 220px); min-height: 520px; }
.view > div > p + p { margin-top: 10px; }

/* Mi rutina */
.rutina h3 { margin-top: 18px; }
.rutina h3:first-of-type { margin-top: 10px; }
.med-group h3 { margin-bottom: 10px; }
.meds { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 560px) { .meds { grid-template-columns: 1fr; } }
.med { display: flex; flex-direction: column; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; padding-bottom: 12px; }
.med-play { position: relative; border: 0; padding: 0; cursor: pointer; background: #000; display: block; }
.med-play img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; opacity: .9; }
.med-play .play { position: absolute; inset: 0; margin: auto; width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--wine); color: #fff; font-size: 20px; padding-left: 4px; }
.med-frame { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; }
.med-title { padding: 8px 14px 0; font-weight: 700; line-height: 1.35; }
.med small { padding: 0 14px; color: var(--muted); font-size: 13.5px; }

/* Guias */
.guides { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-top: 12px; }
.guide { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; color: var(--ink); text-decoration: none; transition: transform .15s, box-shadow .15s; }
.guide:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.08); }
.guide-cover { background: var(--soft); }
/* La proporcion va en la imagen: en Safari height:100% no se resuelve. */
.guide-cover, .guide-cover img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.guide-title { padding: 12px 14px 14px; font-weight: 700; line-height: 1.35; }
.guide-doc { padding-top: 0; overflow: hidden; }
.guide-doc > .guide-hero { display: block; max-width: none; width: calc(100% + 2 * clamp(18px, 4vw, 44px)); margin: 0 calc(-1 * clamp(18px, 4vw, 44px)) 24px; height: clamp(160px, 28vw, 280px); object-fit: cover; }
.guide-doc > h1 { margin-top: 0; }
.guide-doc:not(:has(.guide-hero)) { padding-top: 28px; }
@media (max-width: 700px) { .guides { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; } .guide-title { font-size: 14px; padding: 10px; } }

/* Tablas en informes */
.doc .table-wrap { overflow-x: auto; margin: 0 0 16px; max-width: none; }
.doc table { border-collapse: collapse; width: 100%; font-size: 15px; }
.doc th, .doc td { text-align: left; vertical-align: top; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.doc th { font-weight: 700; color: var(--wine); }
.doc td:first-child { white-space: nowrap; font-weight: 700; }

/* Ebooks adjuntos */
.ebook-row { display: flex; align-items: center; gap: 14px; padding: 10px 0; color: var(--ink); text-decoration: none; border-top: 1px solid var(--line); }
.ebook-row:first-of-type { border-top: 0; }
.ebook-icon { flex: none; width: 44px; height: 54px; border-radius: 6px; background: var(--wine); color: var(--wine-ink); display: grid; place-items: center; font-size: 12px; font-weight: 800; letter-spacing: .04em; }
.ebook-icon.has-cover { width: 72px; height: auto; background: none; border-radius: 6px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.ebook-icon.has-cover img { display: block; width: 100%; height: auto; }
.ebook-name { flex: 1; font-weight: 700; }
.ebook .btn { margin: 0; }

/* Rutina: cada imagen a la izquierda con su texto a la derecha */
.media-row { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 20px; align-items: start; margin: 0 0 22px; max-width: none; }
.media-row img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; }
.media-body > p:first-child { font-weight: 800; color: var(--wine); margin-bottom: 6px; }
.media-body > :last-child { margin-bottom: 0; }
@media (max-width: 600px) { .media-row { grid-template-columns: 76px minmax(0, 1fr); gap: 14px; } }
