:root{
  --bg:#eef2f5;
  --surface:#ffffff;
  --surface-2:#f7f9fb;
  --border:#e2e8ef;
  --primary:#0e7c66;
  --primary-dark:#0a5c4c;
  --primary-soft:#e3f3ee;
  --accent:#f59e0b;
  --danger:#dc2626;
  --danger-soft:#fdecec;
  --text:#16232e;
  --muted:#64798a;
  --shadow:0 1px 3px rgba(16,42,60,.08),0 6px 24px rgba(16,42,60,.06);
  --radius:16px;
  --tecnico:#2563eb;
  --tactico:#7c3aed;
  --fisico:#059669;
  --mental:#db2777;
}
*{box-sizing:border-box;margin:0;padding:0}
html,body{height:100%}
body{
  font-family:'Inter',system-ui,-apple-system,sans-serif;
  background:var(--bg);
  color:var(--text);
  font-size:15px;
  line-height:1.5;
  -webkit-font-smoothing:antialiased;
  padding-top:env(safe-area-inset-top,0);
  padding-bottom:env(safe-area-inset-bottom,0);
}
button{font-family:inherit;cursor:pointer;border:none;background:none}
input,select,textarea{font-family:inherit;font-size:15px}
a{color:var(--primary);text-decoration:none}

/* ---------- Loading ---------- */
.loading-screen{position:fixed;inset:0;display:flex;align-items:center;justify-content:center;background:var(--bg)}
.spinner{width:38px;height:38px;border:3px solid var(--border);border-top-color:var(--primary);border-radius:50%;animation:spin .8s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}

/* ---------- Auth ---------- */
.auth-wrap{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:24px;
  background:linear-gradient(160deg,#0e7c66 0%,#0a5c4c 55%,#083f34 100%);}
.auth-card{background:var(--surface);border-radius:22px;box-shadow:0 20px 60px rgba(0,0,0,.25);width:100%;max-width:400px;padding:34px 28px}
.auth-logo{display:flex;flex-direction:column;align-items:center;gap:10px;margin-bottom:22px}
.auth-logo .ball{width:52px;height:52px;border-radius:50%;background:radial-gradient(circle at 35% 30%,#d9f99d,#a3e635 60%,#65a30d);box-shadow:inset -6px -6px 12px rgba(0,0,0,.15);position:relative}
.auth-logo .ball::before{content:"";position:absolute;inset:0;border-radius:50%;border:2px solid rgba(255,255,255,.55);clip-path:inset(0 0 50% 0)}
.auth-logo h1{font-size:20px;font-weight:800;color:var(--text);letter-spacing:-.02em;text-align:center}
.auth-logo p{color:var(--muted);font-size:13px}
.field{margin-bottom:14px}
.field label{display:block;font-size:12.5px;font-weight:600;color:var(--muted);margin-bottom:6px}
.field input,.field select,.field textarea{width:100%;padding:12px 14px;border:1.5px solid var(--border);border-radius:12px;background:var(--surface-2);color:var(--text);transition:border-color .15s}
.field input:focus,.field select:focus,.field textarea:focus{outline:none;border-color:var(--primary);background:#fff}
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;padding:12px 18px;border-radius:12px;font-weight:600;font-size:15px;background:var(--primary);color:#fff;transition:filter .15s,transform .05s;width:100%}
.btn:hover{filter:brightness(1.05)}
.btn:active{transform:translateY(1px)}
.btn.secondary{background:var(--surface-2);color:var(--text);border:1.5px solid var(--border)}
.btn.danger{background:var(--danger)}
.btn.small{width:auto;padding:8px 14px;font-size:13.5px;border-radius:10px}
.btn.ghost{background:transparent;color:var(--primary);width:auto;padding:6px 8px}
.auth-toggle{text-align:center;margin-top:18px;font-size:13.5px;color:var(--muted)}
.auth-toggle button{color:var(--primary);font-weight:600}
.auth-error{background:var(--danger-soft);color:var(--danger);padding:10px 12px;border-radius:10px;font-size:13px;margin-bottom:14px}
.auth-info{background:var(--primary-soft);color:var(--primary-dark);padding:10px 12px;border-radius:10px;font-size:13px;margin-bottom:14px}

/* ---------- App layout ---------- */
.app-shell{min-height:100vh;display:flex;flex-direction:column}
.topbar{position:sticky;top:0;z-index:20;background:var(--surface);border-bottom:1px solid var(--border);
  display:flex;align-items:center;justify-content:space-between;padding:12px 16px;
  padding-top:calc(12px + env(safe-area-inset-top,0))}
.topbar .brand{display:flex;align-items:center;gap:10px;font-weight:800;font-size:16px;letter-spacing:-.01em}
.topbar .brand .dot{width:26px;height:26px;border-radius:50%;background:radial-gradient(circle at 35% 30%,#d9f99d,#a3e635 60%,#65a30d)}
.topbar .who{display:flex;align-items:center;gap:10px}
.badge{font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.04em;padding:3px 9px;border-radius:999px}
.badge.admin{background:#fde9c8;color:#92590a}
.badge.student{background:var(--primary-soft);color:var(--primary-dark)}
.avatar{width:34px;height:34px;border-radius:50%;background:var(--primary);color:#fff;display:flex;align-items:center;justify-content:center;font-weight:700;font-size:14px}

.layout{flex:1;display:flex;max-width:1100px;width:100%;margin:0 auto}
.sidebar{display:none}
.content{flex:1;padding:18px 16px 90px;width:100%}

/* Desktop */
@media(min-width:860px){
  .sidebar{display:flex;flex-direction:column;gap:4px;width:220px;padding:20px 12px;position:sticky;top:64px;align-self:flex-start}
  .sidebar .navitem{display:flex;align-items:center;gap:10px;padding:11px 14px;border-radius:11px;color:var(--muted);font-weight:600;font-size:14px;width:100%;text-align:left}
  .sidebar .navitem.active{background:var(--primary-soft);color:var(--primary-dark)}
  .sidebar .navitem:hover{background:var(--surface-2)}
  .content{padding:26px 28px 40px}
  .bottomnav{display:none}
}

/* Bottom nav (mobile) */
.bottomnav{position:fixed;bottom:0;left:0;right:0;z-index:20;background:var(--surface);border-top:1px solid var(--border);
  display:flex;justify-content:space-around;padding:6px 4px;padding-bottom:calc(6px + env(safe-area-inset-bottom,0))}
.bottomnav .navitem{flex:1;display:flex;flex-direction:column;align-items:center;gap:3px;padding:5px 2px;color:var(--muted);font-size:10.5px;font-weight:600;border-radius:10px}
.bottomnav .navitem.active{color:var(--primary)}
.bottomnav .navitem svg{width:22px;height:22px}

/* ---------- Cards & components ---------- */
.page-title{font-size:22px;font-weight:800;letter-spacing:-.02em;margin-bottom:4px}
.page-sub{color:var(--muted);font-size:14px;margin-bottom:18px}
.card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);box-shadow:var(--shadow);padding:18px}
.card + .card{margin-top:14px}
.card-title{font-size:15px;font-weight:700;margin-bottom:14px;display:flex;align-items:center;justify-content:space-between;gap:8px}
.grid{display:grid;gap:14px}
.grid.cols-2{grid-template-columns:repeat(2,1fr)}
.grid.cols-3{grid-template-columns:repeat(3,1fr)}
.grid.cols-4{grid-template-columns:repeat(4,1fr)}
@media(max-width:620px){.grid.cols-3,.grid.cols-4{grid-template-columns:repeat(2,1fr)}}

.stat{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:16px;box-shadow:var(--shadow)}
.stat .label{font-size:12.5px;color:var(--muted);font-weight:600;margin-bottom:6px}
.stat .value{font-size:26px;font-weight:800;letter-spacing:-.02em}
.stat .value.sm{font-size:20px}
.stat .sub{font-size:12px;color:var(--muted);margin-top:2px}
.stat.hero{background:linear-gradient(150deg,var(--primary),var(--primary-dark));color:#fff;border:none}
.stat.hero .label{color:rgba(255,255,255,.85)}
.stat.hero .sub{color:rgba(255,255,255,.8)}
.stat.pos .value{color:var(--primary)}
.stat.neg .value{color:var(--danger)}

.progress-ring{--pct:0;width:110px;height:110px;border-radius:50%;
  background:conic-gradient(var(--primary) calc(var(--pct)*1%),var(--border) 0);
  display:flex;align-items:center;justify-content:center;margin:0 auto}
.progress-ring .inner{width:82px;height:82px;background:var(--surface);border-radius:50%;display:flex;flex-direction:column;align-items:center;justify-content:center}
.progress-ring .inner b{font-size:22px;font-weight:800}
.progress-ring .inner span{font-size:10.5px;color:var(--muted)}

.list{display:flex;flex-direction:column;gap:8px}
.row-item{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:12px 14px;background:var(--surface-2);border:1px solid var(--border);border-radius:12px}
.row-item .ri-main{font-weight:600;font-size:14px}
.row-item .ri-sub{font-size:12.5px;color:var(--muted)}
.row-item.click{cursor:pointer;transition:background .12s}
.row-item.click:hover{background:var(--primary-soft)}

.tag{display:inline-flex;align-items:center;gap:5px;font-size:11.5px;font-weight:700;padding:3px 9px;border-radius:999px;background:var(--surface-2);color:var(--muted);text-transform:capitalize}
.tag.entrenamiento{background:#e0edff;color:#1d4ed8}
.tag.clase{background:var(--primary-soft);color:var(--primary-dark)}
.tag.didactico{background:#fef3c7;color:#92590a}
.tag.tecnico{background:#dbeafe;color:var(--tecnico)}
.tag.tactico{background:#ede9fe;color:var(--tactico)}
.tag.fisico{background:#d1fae5;color:var(--fisico)}
.tag.mental{background:#fce7f3;color:var(--mental)}

.aspect-card{border:1px solid var(--border);border-radius:14px;padding:14px;background:var(--surface)}
.aspect-card h4{font-size:14px;font-weight:700;margin-bottom:10px;display:flex;align-items:center;gap:8px}
.aspect-card .dot{width:10px;height:10px;border-radius:50%}
.aspect-card .block{margin-bottom:8px}
.aspect-card .block .bt{font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.03em;margin-bottom:4px}
.aspect-card .fort{color:var(--fisico)}
.aspect-card .mej{color:var(--accent)}
.aspect-card ul{list-style:none;display:flex;flex-direction:column;gap:4px}
.aspect-card li{font-size:13.5px;padding-left:16px;position:relative}
.aspect-card li::before{content:"";position:absolute;left:2px;top:8px;width:5px;height:5px;border-radius:50%;background:var(--muted)}
.aspect-card li .del{color:var(--danger);float:right;font-weight:700;cursor:pointer;padding:0 4px}

.empty{text-align:center;color:var(--muted);padding:28px 12px;font-size:13.5px}
.empty svg{width:40px;height:40px;opacity:.4;margin-bottom:8px}

/* choice pills */
.choices{display:flex;gap:8px;flex-wrap:wrap}
.choice{flex:1;min-width:90px;padding:14px 10px;border:1.5px solid var(--border);border-radius:12px;text-align:center;font-weight:600;font-size:13.5px;background:var(--surface);transition:all .12s}
.choice.active{border-color:var(--primary);background:var(--primary-soft);color:var(--primary-dark)}
.choice .emoji{display:block;font-size:22px;margin-bottom:4px}

/* chat */
.chat-box{display:flex;flex-direction:column;height:60vh;min-height:360px}
.chat-msgs{flex:1;overflow-y:auto;display:flex;flex-direction:column;gap:8px;padding:4px 2px}
.msg{max-width:78%;padding:9px 13px;border-radius:14px;font-size:14px;position:relative;word-wrap:break-word}
.msg.mine{align-self:flex-end;background:var(--primary);color:#fff;border-bottom-right-radius:4px}
.msg.theirs{align-self:flex-start;background:var(--surface-2);border:1px solid var(--border);border-bottom-left-radius:4px}
.msg .time{font-size:10px;opacity:.7;margin-top:3px;display:block}
.msg video,.msg img{max-width:100%;border-radius:10px;margin-top:6px;display:block}
.chat-input{display:flex;gap:8px;align-items:center;margin-top:10px;border-top:1px solid var(--border);padding-top:10px}
.chat-input input[type=text]{flex:1;padding:11px 14px;border:1.5px solid var(--border);border-radius:999px;background:var(--surface-2)}
.chat-input .iconbtn{width:44px;height:44px;border-radius:50%;background:var(--primary);color:#fff;display:flex;align-items:center;justify-content:center;flex-shrink:0}
.chat-input .attachbtn{width:44px;height:44px;border-radius:50%;background:var(--surface-2);border:1.5px solid var(--border);display:flex;align-items:center;justify-content:center;flex-shrink:0;color:var(--muted)}

/* modal */
.modal-overlay{position:fixed;inset:0;background:rgba(10,25,35,.55);z-index:50;display:flex;align-items:flex-end;justify-content:center;padding:0}
@media(min-width:600px){.modal-overlay{align-items:center;padding:20px}}
.modal{background:var(--surface);border-radius:22px 22px 0 0;width:100%;max-width:480px;max-height:92vh;overflow-y:auto;padding:22px 20px calc(22px + env(safe-area-inset-bottom,0))}
@media(min-width:600px){.modal{border-radius:20px}}
.modal h3{font-size:18px;font-weight:800;margin-bottom:16px;letter-spacing:-.01em}
.modal-close{position:absolute}
.modal-actions{display:flex;gap:10px;margin-top:8px}
.modal-actions .btn{flex:1}

.seg{display:flex;gap:6px;background:var(--surface-2);border:1px solid var(--border);padding:4px;border-radius:12px;margin-bottom:16px;overflow-x:auto}
.seg button{flex:1;white-space:nowrap;padding:8px 12px;border-radius:9px;font-weight:600;font-size:13px;color:var(--muted)}
.seg button.active{background:var(--surface);color:var(--text);box-shadow:var(--shadow)}

.month-nav{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:16px}
.month-nav .mtitle{font-weight:700;font-size:15px;text-transform:capitalize}
.month-nav button{width:36px;height:36px;border-radius:10px;background:var(--surface);border:1px solid var(--border);color:var(--text);font-size:18px;display:flex;align-items:center;justify-content:center}

.pill-row{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:6px}
.money{font-variant-numeric:tabular-nums}
.divider{height:1px;background:var(--border);margin:14px 0}
.helper{font-size:12.5px;color:var(--muted);margin-top:6px}
.toast{position:fixed;bottom:80px;left:50%;transform:translateX(-50%);background:#16232e;color:#fff;padding:11px 18px;border-radius:12px;font-size:13.5px;z-index:100;box-shadow:0 8px 30px rgba(0,0,0,.3);animation:toastin .2s}
@keyframes toastin{from{opacity:0;transform:translateX(-50%) translateY(8px)}}
.back-link{display:inline-flex;align-items:center;gap:6px;color:var(--muted);font-weight:600;font-size:13.5px;margin-bottom:12px}
.week-line{display:flex;gap:10px;align-items:flex-start;padding:10px 0;border-bottom:1px dashed var(--border)}
.week-line:last-child{border-bottom:none}
.week-badge{flex-shrink:0;width:60px;font-size:11px;font-weight:700;color:var(--primary-dark);background:var(--primary-soft);border-radius:8px;padding:4px 6px;text-align:center}

/* ---------- extra: público + tienda ---------- */
.auth-back{position:absolute;top:16px;left:16px;color:var(--muted);font-weight:600;font-size:13px}
.auth-card{position:relative}
/* ocultar el badge que inyecta Netlify (tapa el menú en el celu) */
#nl-badge-frame,#netlify-badge,.netlify-badge,iframe[id*="nl-badge"]{display:none!important;visibility:hidden!important}
.auth-note{text-align:center;margin-top:16px;font-size:13px;color:var(--muted)}
.auth-wrap.admin{background:linear-gradient(160deg,#16232e 0%,#0e3a30 60%,#083f34 100%)}

.brand[data-go]{cursor:pointer}
.topbar .who{gap:8px}
.cartbtn{position:relative;width:40px;height:40px;border-radius:11px;background:var(--surface-2);border:1px solid var(--border);color:var(--text);display:flex;align-items:center;justify-content:center}
.cartbtn svg{width:20px;height:20px}
.cart-badge{position:absolute;top:-5px;right:-5px;min-width:18px;height:18px;padding:0 4px;border-radius:999px;background:var(--accent);color:#fff;font-size:11px;font-weight:700;display:none;align-items:center;justify-content:center}
.cart-badge.inline{position:static;display:inline-flex;margin-left:2px}
.btn.small svg{width:16px;height:16px}
#loginBtn{width:auto;gap:6px}

.bottomnav.scroll{overflow-x:auto;justify-content:flex-start;-webkit-overflow-scrolling:touch}
.bottomnav.scroll .navitem{min-width:64px;flex:0 0 auto}

/* hero */
.hero{background:linear-gradient(155deg,var(--primary),var(--primary-dark) 60%,#083f34);border-radius:22px;padding:32px 22px;text-align:center;color:#fff;position:relative;overflow:hidden}
.hero-ball{width:46px;height:46px;border-radius:50%;margin:0 auto 14px;background:radial-gradient(circle at 35% 30%,#d9f99d,#a3e635 60%,#65a30d);box-shadow:inset -5px -5px 10px rgba(0,0,0,.15)}
.hero h1{font-size:30px;font-weight:800;letter-spacing:-.02em;margin-bottom:8px}
.hero p{color:rgba(255,255,255,.9);font-size:15px;max-width:520px;margin:0 auto 18px}
.hero-cta{display:flex;gap:10px;justify-content:center;flex-wrap:wrap}
.hero-cta .btn{width:auto;padding:12px 22px}
.hero-cta .btn.secondary{background:rgba(255,255,255,.15);color:#fff;border:1.5px solid rgba(255,255,255,.35)}
.hero-login{display:block;margin:16px auto 0;color:rgba(255,255,255,.85);font-weight:600;font-size:13.5px;text-decoration:underline}

.section-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin:10px 0 12px}
.section-head h2{font-size:18px;font-weight:800;letter-spacing:-.01em}
.card.feature{text-align:center}
.card.feature .fic{width:44px;height:44px;margin:0 auto 10px;border-radius:12px;background:var(--primary-soft);color:var(--primary-dark);display:flex;align-items:center;justify-content:center}
.card.feature .fic svg{width:24px;height:24px}
.card.feature .femoji{font-size:30px;margin-bottom:8px}
.card.feature h3{font-size:15px;font-weight:700;margin-bottom:4px}
.card.feature p{font-size:13px;color:var(--muted)}
.pillar{display:flex;align-items:center;gap:8px;padding:10px 12px;background:var(--surface-2);border:1px solid var(--border);border-radius:12px;font-size:14px}
.pillar .dot{width:11px;height:11px;border-radius:50%}
.cta-card{text-align:center;background:linear-gradient(150deg,var(--primary-soft),#fff)}
.cta-card h3{font-size:16px;font-weight:800;margin-bottom:6px}
.cta-card p{color:var(--muted);font-size:14px;margin-bottom:14px}
.cta-card .btn{width:auto;margin:0 auto;padding:11px 22px}

/* tienda */
.store-head{display:flex;align-items:flex-end;justify-content:space-between;gap:10px;margin-bottom:6px}
.store-head .cart-open{width:auto;gap:6px;flex-shrink:0}
.searchbar{display:flex;align-items:center;gap:8px;background:var(--surface);border:1.5px solid var(--border);border-radius:12px;padding:10px 14px;margin:12px 0}
.searchbar svg{width:18px;height:18px;color:var(--muted);flex-shrink:0}
.searchbar input{flex:1;border:none;background:none;outline:none;font-size:15px}
.card.prod{padding:0;overflow:hidden;display:flex;flex-direction:column}
.prod-img{width:100%;aspect-ratio:1/1;background-size:cover;background-position:center;background-color:var(--surface-2)}
.prod-img.noimg{display:flex;align-items:center;justify-content:center;color:var(--border)}
.prod-img.noimg svg{width:46px;height:46px}
.prod-body{padding:12px;display:flex;flex-direction:column;gap:6px;flex:1}
.prod-name{font-weight:700;font-size:14px;line-height:1.3}
.prod-desc{font-size:12.5px;color:var(--muted);display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.prod-foot{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-top:auto;padding-top:4px}
.prod-price{font-weight:800;font-size:15px}
.prod-foot .btn.small{width:auto}

/* carrito modal */
.cart-list{display:flex;flex-direction:column;gap:10px;margin-bottom:14px;max-height:46vh;overflow-y:auto}
.cart-row{display:flex;align-items:center;gap:10px}
.cart-thumb{width:46px;height:46px;border-radius:10px;background-size:cover;background-position:center;background-color:var(--surface-2);flex-shrink:0;display:flex;align-items:center;justify-content:center;color:var(--border)}
.cart-thumb svg{width:22px;height:22px}
.qty{display:flex;align-items:center;gap:8px;background:var(--surface-2);border:1px solid var(--border);border-radius:10px;padding:3px 6px}
.qty button{width:26px;height:26px;border-radius:7px;background:var(--surface);border:1px solid var(--border);font-size:16px;font-weight:700;color:var(--text);display:flex;align-items:center;justify-content:center}
.qty span{min-width:18px;text-align:center;font-weight:700}
.cart-total{display:flex;align-items:center;justify-content:space-between;padding:12px 0;border-top:1px solid var(--border);font-size:15px}
.cart-total b{font-size:19px}
.ok-check{width:60px;height:60px;border-radius:50%;background:var(--primary);color:#fff;font-size:32px;display:flex;align-items:center;justify-content:center;margin:0 auto 12px}

/* pedidos admin */
.card.order{padding:14px}
.order-head{display:flex;align-items:flex-start;justify-content:space-between;gap:10px;margin-bottom:8px}
.order-items{display:flex;flex-direction:column;gap:3px;margin-bottom:8px;padding:8px 10px;background:var(--surface-2);border-radius:10px}
.order-items .oi{font-size:13px;display:flex;justify-content:space-between;gap:8px}
.order-foot{display:flex;align-items:center;gap:8px;margin-top:8px}
.status-sel{padding:7px 10px;border-radius:9px;border:1.5px solid var(--border);font-weight:600;font-size:13px;background:var(--surface)}
.status-sel.st-nuevo{border-color:var(--accent);color:#92590a;background:#fff7e6}
.status-sel.st-preparando{border-color:#2563eb;color:#1d4ed8;background:#eff4ff}
.status-sel.st-entregado{border-color:var(--primary);color:var(--primary-dark);background:var(--primary-soft)}
.status-sel.st-cancelado{border-color:var(--danger);color:var(--danger);background:var(--danger-soft)}
.order-foot .btn{width:auto}
