/* Bunda Fit · estilos de la app. Escritos a mano, sin compilación.
   Marca: crema y espresso con dorado (bundafit.cl); Cormorant Garamond para títulos y Outfit para texto.
   En el celular el menú va abajo, como app; desde 900 px pasa a una columna lateral. */
:root {
  --bg: #FBFBEF;
  --bg-2: #F5F5DC;
  --card: #FFFFFA;
  --ink: #1C130E;
  --muted: #5A4A3C;
  --line: #E3D8BC;
  --gold: #B8924A;
  --gold-2: #CFB06F;
  --gold-ink: #85622A;
  --gold-soft: #F2E7CB;
  --espresso: #1C130E;
  --espresso-2: #2C1F16;
  --cream-ink: #F3EAD6;
  --cream-muted: #C3B092;
  --ok: #4D6A34;
  --ok-soft: #E2EAD2;
  --warn: #8F4E12;
  --warn-soft: #F6E2C8;
  --danger: #A2322A;
  --danger-soft: #F7DCD6;
  --wa: #1E8449;
  --shadow: 0 1px 2px rgba(28, 19, 14, .06), 0 8px 22px rgba(28, 19, 14, .08);
  --display: 'Cormorant Garamond', Garamond, 'Times New Roman', serif;
  --body: 'Outfit', 'Segoe UI', system-ui, Arial, sans-serif;
  --tabbar: 64px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.5 var(--body); -webkit-font-smoothing: antialiased; }
h1, h2, h3, p, ul, ol, figure, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: var(--gold-ink); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ico { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
h1 { font: 600 30px/1.1 var(--display); text-wrap: balance; }
h2 { font: 600 23px/1.15 var(--display); text-wrap: balance; }
h3 { font: 600 19px/1.2 var(--display); }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.label { font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; font-weight: 600; color: var(--gold-ink); }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.stack { display: grid; gap: 14px; align-content: start; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }

/* Estructura */
.app { min-height: 100vh; padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom, 0px)); }
.topbar { position: sticky; top: 0; z-index: 20; background: var(--espresso); color: var(--cream-ink); padding: calc(env(safe-area-inset-top, 0px) + 10px) max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px)); display: flex; align-items: center; gap: 12px; }
.topbar .logo { height: 26px; width: auto; }
.topbar .who { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--cream-muted); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, var(--gold-2), var(--gold)); color: var(--ink); display: grid; place-items: center; font-weight: 600; font-size: 13px; text-decoration: none; flex: none; }
.main { padding: 18px max(16px, env(safe-area-inset-right, 0px)) 28px max(16px, env(safe-area-inset-left, 0px)); max-width: 1100px; margin: 0 auto; display: grid; gap: 18px; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-head p { color: var(--muted); }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--card); border-top: 1px solid var(--line); display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding-bottom: env(safe-area-inset-bottom, 0px); padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 9px 2px 8px; font-size: 11px; font-weight: 500; color: var(--muted); text-decoration: none; position: relative; min-width: 0; }
.tabbar a[aria-current="page"] { color: var(--gold-ink); font-weight: 600; }
.tabbar a[aria-current="page"]::before { content: ""; position: absolute; top: 0; left: 25%; right: 25%; height: 2px; background: var(--gold); border-radius: 2px; }
.tabbar .badge, .side .badge { position: absolute; top: 4px; left: calc(50% + 6px); min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 600; line-height: 17px; text-align: center; }
.side { display: none; }
.more-menu { display: grid; gap: 8px; }
@media (min-width: 900px) {
  .app { display: grid; grid-template-columns: 230px minmax(0, 1fr); padding-bottom: 0; }
  .topbar { grid-column: 1 / -1; }
  .tabbar { display: none; }
  .side { display: flex; flex-direction: column; gap: 4px; background: var(--espresso); padding: 18px 12px; position: sticky; top: 54px; height: calc(100vh - 54px); }
  .side a { position: relative; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: var(--cream-muted); text-decoration: none; font-size: 15px; }
  .side a:hover { color: var(--cream-ink); }
  .side a[aria-current="page"] { background: var(--espresso-2); color: var(--cream-ink); box-shadow: inset 3px 0 0 var(--gold); }
  .side .badge { position: static; margin-left: auto; }
  .side .sep { height: 1px; background: #3A2C22; margin: 10px 4px; }
  .main { padding: 26px 32px 40px; }
  h1 { font-size: 36px; }
}

/* Tarjetas y listas */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; display: grid; gap: 12px; min-width: 0; }
.card.dark { background: var(--espresso); border-color: var(--espresso); color: var(--cream-ink); }
.card.dark .label { color: var(--gold-2); }
.card.dark .muted { color: var(--cream-muted); }
.card.alert { border-color: var(--gold); box-shadow: inset 3px 0 0 var(--gold); }
.cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); align-items: start; }
.list > li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.list > li:first-child { border-top: 0; padding-top: 0; }
.list > li:last-child { padding-bottom: 0; }
.list .grow small { display: block; color: var(--muted); font-size: 13px; }
.list a.grow, .list .grow > a { color: var(--ink); text-decoration: none; }
.list a.grow:hover, .list .grow > a:hover { color: var(--gold-ink); }
.list a.grow b, .list .grow > a b { font-weight: 600; }
.list details { margin-left: auto; }
.list details[open] { flex-basis: 100%; padding-top: 4px; }
td:first-child { white-space: nowrap; }
.empty { color: var(--muted); font-size: 14.5px; padding: 6px 0; }
.kpis { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; display: grid; gap: 2px; }
.kpi b { font: 600 26px/1.1 var(--display); font-variant-numeric: tabular-nums; }
.kpi span { font-size: 12.5px; color: var(--muted); }
.kpi.money b { font: 600 19px/1.3 var(--body); }
.kpi.good b { color: var(--ok); }
.kpi.bad b { color: var(--danger); }

/* Estados */
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--bg-2); color: var(--muted); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--danger-soft); color: var(--danger); }
.pill.gold { background: var(--gold-soft); color: var(--gold-ink); }
.pill.dark { background: var(--espresso); color: var(--cream-ink); }

/* Botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 999px; padding: 10px 18px; font-weight: 600; font-size: 15px; text-decoration: none; background: linear-gradient(135deg, var(--gold-2), var(--gold)); color: var(--ink); white-space: nowrap; }
.btn:hover { filter: brightness(1.05); }
.btn.ghost { background: transparent; box-shadow: inset 0 0 0 1px var(--gold); color: var(--ink); }
.btn.dark { background: var(--espresso); color: var(--cream-ink); }
.btn.wa { background: var(--wa); color: #fff; }
.btn.sm { padding: 6px 12px; font-size: 13.5px; }
.btn.block { width: 100%; }
.btn .ico { width: 18px; height: 18px; }
.link { border: 0; background: none; padding: 0; color: var(--gold-ink); font-weight: 600; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }
.link.danger { color: var(--danger); }
form.inline { display: inline; }

/* Formularios */
.form { display: grid; gap: 14px; }
.fields { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.field { display: grid; gap: 4px; font-size: 13.5px; font-weight: 600; color: var(--muted); min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field input, .field select, .field textarea, .input { width: 100%; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 10px 12px; font-size: 16px; font-weight: 400; color: var(--ink); }
.field textarea { min-height: 84px; resize: vertical; }
.field small { font-weight: 400; color: var(--muted); }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 15px; font-weight: 400; color: var(--ink); }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--gold); flex: none; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.checks label { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: #fff; font-size: 14px; }
.checks input { accent-color: var(--gold); }
.flash { background: var(--ok-soft); color: var(--ok); border-radius: 12px; padding: 12px 14px; font-weight: 500; }
.errors { background: var(--danger-soft); color: var(--danger); border-radius: 12px; padding: 12px 14px; font-size: 14.5px; }
.errors li + li { margin-top: 4px; }
.hint { font-size: 13px; color: var(--muted); }

/* Pestañas y días */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.tabs a, .tabs button { flex: none; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 7px 14px; font-size: 14px; color: var(--muted); text-decoration: none; }
.tabs [aria-current="page"], .tabs [aria-pressed="true"] { background: var(--espresso); border-color: var(--espresso); color: var(--cream-ink); }
.days { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.days a { flex: none; width: 56px; border: 1px solid var(--line); background: var(--card); border-radius: 14px; padding: 6px 0; display: grid; justify-items: center; text-decoration: none; color: var(--ink); position: relative; }
.days small { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.days b { font: 600 21px/1.1 var(--display); }
.days a[aria-current="page"] { background: var(--espresso); border-color: var(--espresso); color: var(--cream-ink); }
.days a[aria-current="page"] small { color: var(--cream-muted); }
.days .mk { position: absolute; bottom: 4px; width: 5px; height: 5px; border-radius: 50%; background: var(--gold); }

/* Agenda */
.block { display: grid; gap: 8px; }
.block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.block-head h3 { font-size: 21px; }
.dots { display: inline-flex; gap: 4px; vertical-align: middle; }
.dots i { width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid var(--gold); }
.dots i.t { background: var(--muted); border-color: transparent; opacity: .4; }
.dots i.me { background: var(--gold); }
.who-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.who-row .grow { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: #fff; }
.seg button { border: 0; background: transparent; padding: 5px 10px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.seg button[aria-pressed="true"].ok { background: var(--ok-soft); color: var(--ok); }
.seg button[aria-pressed="true"].bad { background: var(--danger-soft); color: var(--danger); }

/* Rutinas */
.ex { display: grid; gap: 8px; padding: 12px 0; border-top: 1px solid var(--line); }
.ex:first-child { border-top: 0; padding-top: 0; }
.ex-name { font-weight: 600; }
.ex-meta { font-size: 13.5px; color: var(--muted); }
.ex-note { font-size: 13px; color: var(--gold-ink); font-style: italic; }
.ex-inputs { display: grid; grid-template-columns: 90px 90px minmax(0, 1fr); gap: 8px; align-items: end; }
.ex-inputs .field { font-size: 12px; }
.ex-inputs input { padding: 8px 10px; }
.last { font-size: 12.5px; color: var(--muted); }
.last b { color: var(--ink); }
details.how summary { cursor: pointer; font-size: 13px; color: var(--gold-ink); font-weight: 600; }
details.how p { font-size: 13.5px; color: var(--muted); margin-top: 6px; }
.editor-day { border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: grid; gap: 10px; background: #fff; }
.editor-items { display: grid; gap: 8px; }
.editor-item { display: grid; gap: 6px; grid-template-columns: minmax(0, 2.2fr) 64px minmax(0, 1fr) minmax(0, 1fr) 36px; align-items: end; padding-top: 8px; border-top: 1px dashed var(--line); }
.editor-item.with-load { grid-template-columns: minmax(0, 2.2fr) 64px minmax(0, 1fr) minmax(0, 1fr) 80px 36px; }
.editor-item .note { grid-column: 1 / -2; }
.editor-item .field { font-size: 11.5px; }
.editor-item input, .editor-item select { padding: 7px 8px; font-size: 14.5px; }
.icon-btn { border: 1px solid var(--line); background: #fff; border-radius: 10px; width: 36px; height: 36px; display: grid; place-items: center; color: var(--danger); }
@media (max-width: 640px) {
  .editor-item, .editor-item.with-load { grid-template-columns: 1fr 1fr; }
  .editor-item .exercise, .editor-item .note { grid-column: 1 / -1; }
  .ex-inputs { grid-template-columns: 1fr 1fr; }
  .ex-inputs .field:last-child { grid-column: 1 / -1; }
}

/* Tablas */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th { text-align: left; font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; }

/* Gráfico y barras */
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid line { stroke: var(--line); }
.chart text { fill: var(--muted); font: 400 11px var(--body); }
.chart .line { fill: none; stroke: var(--gold-ink); stroke-width: 2; stroke-linejoin: round; }
.chart .pt { fill: var(--gold-ink); stroke: var(--card); stroke-width: 2; }
.chart .val { fill: var(--ink); font-weight: 600; font-size: 12px; }
.bars { display: grid; gap: 8px; }
.bar { display: grid; grid-template-columns: minmax(90px, 160px) minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 14px; }
.bar .track { height: 10px; background: var(--bg-2); border-radius: 0 5px 5px 0; overflow: hidden; }
.bar .track i { display: block; height: 100%; background: var(--gold); border-radius: 0 5px 5px 0; min-width: 2px; }
.bar.out .track i { background: var(--muted); }
.months { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; align-items: end; height: 120px; }
.months div { display: grid; gap: 4px; align-content: end; height: 100%; text-align: center; font-size: 11.5px; color: var(--muted); }
.months i { display: block; background: var(--gold); border-radius: 4px 4px 0 0; min-height: 2px; }
.months i.neg { background: var(--danger); }

/* Fotos */
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.photos figure { display: grid; gap: 6px; }
.photos img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 12px; background: var(--bg-2); }
.photos figcaption { font-size: 12.5px; color: var(--muted); display: grid; gap: 4px; }

/* Ayuda */
details.card > summary { cursor: pointer; list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::after { content: "+"; float: right; font-size: 22px; line-height: 1; color: var(--gold-ink); }
details.card[open] > summary::after { content: "–"; }
.ticks { display: grid; gap: 8px; }
.ticks li { position: relative; padding-left: 16px; }
.ticks li::before { content: ""; position: absolute; left: 2px; top: .6em; width: 6px; height: 6px; border-radius: 50%; background: var(--gold); }

/* Pantallas sin sesión */
.guest { min-height: 100vh; display: grid; place-items: start center; padding: calc(env(safe-area-inset-top, 0px) + 28px) max(16px, env(safe-area-inset-right, 0px)) 40px max(16px, env(safe-area-inset-left, 0px)); background: radial-gradient(120% 60% at 50% 0%, var(--espresso) 0 38%, var(--bg) 38.2%); }
.guest-box { width: 100%; max-width: 480px; display: grid; gap: 18px; }
.guest-box .brand { display: grid; justify-items: center; gap: 6px; color: var(--cream-ink); text-align: center; padding: 10px 0 6px; }
.guest-box .brand img { height: 46px; width: auto; }
.guest-box .brand p { font: italic 500 17px var(--display); color: var(--cream-muted); }
.guest-box .card { padding: 22px; box-shadow: var(--shadow); }
