/* Paneles (dueño, superadmin) y app de socios: barra lateral en escritorio, barra inferior en el celular. */
body.app { min-height: 100dvh; background: radial-gradient(1200px 600px at 100% -10%, color-mix(in srgb, var(--accent) 7%, transparent), transparent 60%), var(--bg); }
.shell { display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: 100dvh; }
.side { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; gap: 6px; padding: 22px 16px; border-right: 1px solid var(--line); background: color-mix(in srgb, var(--bg-2) 92%, transparent); }
.side-brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 22px; text-decoration: none; }
.side-brand .logo { width: 38px; height: 38px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-family: var(--f-display); font-weight: 800; font-size: 1.15rem; flex: none; overflow: hidden; }
.side-brand .logo img { width: 100%; height: 100%; object-fit: cover; }
.side-brand b { font-family: var(--f-display); font-size: 1.35rem; text-transform: uppercase; letter-spacing: .03em; line-height: 1; display: block; }
.side-brand small { color: var(--faint); font-size: .76rem; display: block; margin-top: 3px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px; color: var(--muted); text-decoration: none; font-weight: 500; font-size: .95rem; border: 1px solid transparent; background: none; cursor: pointer; width: 100%; text-align: left; transition: background .15s, color .15s; }
.nav-item svg { width: 19px; height: 19px; flex: none; }
.nav-item:hover { color: var(--fg); background: var(--surface); }
.nav-item.on { color: var(--fg); background: var(--surface-2); border-color: var(--line); }
.nav-item.on svg { color: var(--accent); }
.nav-item .count { margin-left: auto; font-size: .72rem; font-weight: 700; background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 2px 7px; }
.side-foot { margin-top: auto; display: grid; gap: 10px; padding-top: 16px; border-top: 1px solid var(--line); }
.who { display: flex; align-items: center; gap: 10px; padding: 4px 6px; min-width: 0; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--surface-3); display: grid; place-items: center; font-weight: 700; font-size: .85rem; flex: none; color: var(--fg); border: 1px solid var(--line-2); }
.who span { min-width: 0; }
.who strong { display: block; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who small { color: var(--faint); font-size: .78rem; }
.main { min-width: 0; padding: 34px clamp(18px, 4vw, 48px) 80px; }
.page-h { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 28px; }
.page-h h1 { font-size: clamp(2.2rem, 4.5vw, 3.2rem); font-weight: 800; }
.page-h p { color: var(--muted); margin-top: 8px; max-width: 60ch; }
.tabbar { display: none; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; display: grid; gap: 6px; position: relative; overflow: hidden; }
.stat::after { content: ""; position: absolute; right: -30px; top: -30px; width: 90px; height: 90px; border-radius: 50%; background: var(--accent-soft); }
.stat small { color: var(--muted); font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
.stat b { font-family: var(--f-display); font-size: 2.6rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.stat span { color: var(--faint); font-size: .82rem; }
.cols { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.list { display: grid; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item strong { display: block; font-weight: 600; font-size: .95rem; }
.list-item small { color: var(--faint); font-size: .82rem; }
.banner { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; padding: 18px 20px; border-radius: var(--radius); border: 1px solid var(--line-2); background: var(--surface); margin-bottom: 22px; }
.banner.warn { border-color: color-mix(in srgb, var(--warn) 50%, transparent); background: color-mix(in srgb, var(--warn) 8%, var(--surface)); }
.banner.danger { border-color: color-mix(in srgb, var(--danger) 50%, transparent); background: color-mix(in srgb, var(--danger) 8%, var(--surface)); }
.banner.ok { border-color: color-mix(in srgb, var(--ok) 45%, transparent); background: color-mix(in srgb, var(--ok) 7%, var(--surface)); }
.banner .grow { flex: 1; min-width: 220px; }
.banner strong { display: block; font-size: 1.02rem; }
.banner p { color: var(--muted); font-size: .92rem; margin-top: 3px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar .input { max-width: 320px; }
.actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: nowrap; }
.seg { display: inline-flex; background: var(--bg-2); border: 1px solid var(--line); border-radius: 11px; padding: 4px; gap: 4px; flex-wrap: wrap; }
.seg button { border: 0; background: none; color: var(--muted); padding: 8px 14px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: .88rem; }
.seg button.on { background: var(--surface-3); color: var(--fg); }

/* Explorador de ejercicios */
.exb { display: grid; gap: 14px; }
.exb-top { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.exb-search { position: relative; flex: 1; min-width: 220px; display: block; }
.exb-search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--faint); }
.exb-search .input { padding-left: 40px; }
.exb-filter { display: grid; gap: 8px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.exb-more { display: flex; justify-content: center; padding-top: 6px; }

/* Vista de planilla */
.rv { display: grid; gap: 16px; }
.rv-day { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.rv-day-h { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--bg-2); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.rv-day-h h4 { font-size: 1.3rem; flex: 1; min-width: 140px; }
.rv-list { list-style: none; margin: 0; padding: 0; counter-reset: ex; }
.rv-item { display: grid; grid-template-columns: 54px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.rv-item:last-child { border-bottom: 0; }
.rv-item[data-exinfo] { cursor: pointer; }
.rv-item[data-exinfo]:hover { background: var(--surface-2); }
.rv-thumb { width: 54px; height: 54px; border-radius: 9px; background: var(--surface-3); overflow: hidden; display: block; flex: none; }
.rv-thumb img { width: 100%; height: 100%; object-fit: cover; background: #fff; }
.rv-name { display: grid; gap: 2px; min-width: 0; }
.rv-name strong { font-weight: 600; font-size: .96rem; line-height: 1.3; }
.rv-name small, .rv-dose small { color: var(--faint); font-size: .8rem; }
.rv-dose { text-align: right; display: grid; gap: 2px; }
.rv-dose b { font-family: var(--f-display); font-size: 1.25rem; letter-spacing: .03em; }

/* Editor de planilla */
.rb { display: grid; gap: 16px; }
.rb-days { display: grid; gap: 14px; }
.rb-day { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: grid; gap: 12px; background: var(--bg-2); }
.rb-day-h { display: flex; gap: 10px; }
.rb-day-h .input { font-weight: 600; }
.rb-items { display: grid; gap: 8px; }
.rb-item { display: grid; grid-template-columns: 46px minmax(140px, 1fr) 72px 92px 92px minmax(110px, 1fr) auto; gap: 10px; align-items: end; padding: 10px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); }
.rb-item .rv-thumb { width: 46px; height: 46px; align-self: center; }
.rb-name { align-self: center; font-size: .92rem; font-weight: 600; line-height: 1.25; }
.rb-mini { display: grid; gap: 4px; }
.rb-mini span { font-size: .7rem; color: var(--faint); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.rb-mini .input { padding: 8px 10px; font-size: .9rem; }
.rb-tools { display: flex; gap: 4px; }
.rb-tools .icon-btn { width: 32px; height: 32px; }

/* Imagen con vista previa */
.img-row { display: flex; gap: 12px; align-items: center; }
.img-prev { width: 84px; height: 84px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-2); overflow: hidden; display: grid; place-items: center; flex: none; color: var(--faint); font-size: .72rem; text-align: center; }
.img-prev img { width: 100%; height: 100%; object-fit: cover; }
.loading-btn { opacity: .5; pointer-events: none; }

/* Pantalla de acceso */
.auth { min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth-art { position: relative; overflow: hidden; background: var(--surface); display: flex; align-items: flex-end; padding: 48px; }
.auth-art::before { content: ""; position: absolute; inset: 0; background: var(--art, none) center / cover; opacity: .5; }
.auth-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(11, 11, 12, .1), rgba(11, 11, 12, .92)), radial-gradient(600px 300px at 0% 100%, color-mix(in srgb, var(--accent) 30%, transparent), transparent 70%); }
.auth-art > * { position: relative; z-index: 1; }
.auth-art h2 { font-size: clamp(2.6rem, 5vw, 4.4rem); font-weight: 800; }
.auth-art p { color: var(--muted); margin-top: 14px; max-width: 42ch; font-size: 1.05rem; }
.auth-form { display: grid; place-items: center; padding: 40px 20px; }
.auth-box { width: min(420px, 100%); display: grid; gap: 20px; }
.auth-box h1 { font-size: 2.6rem; font-weight: 800; }
.auth-box .back { color: var(--muted); text-decoration: none; font-size: .9rem; }
.auth-box .back:hover { color: var(--fg); }

@media (max-width: 980px) {
  .cols { grid-template-columns: minmax(0, 1fr); }
  .rb-item { grid-template-columns: 46px minmax(0, 1fr) auto; }
  .rb-item .rb-mini { grid-column: span 1; }
  .rb-item .rb-mini:nth-of-type(1) { grid-column: 1 / span 1; }
  .rb-items .rb-item { grid-template-areas: none; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; }
  .main { padding: 20px 16px 110px; }
  .tabbar { display: flex; position: fixed; z-index: 50; left: 0; right: 0; bottom: 0; background: color-mix(in srgb, var(--bg-2) 94%, transparent); backdrop-filter: blur(12px); border-top: 1px solid var(--line); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); overflow-x: auto; }
  .tabbar .nav-item { flex-direction: column; gap: 4px; font-size: .68rem; padding: 7px 4px; text-align: center; justify-content: center; min-width: 64px; flex: 1; }
  .tabbar .nav-item .count { display: none; }
  .mobile-top { display: flex !important; }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-art { min-height: 220px; padding: 28px 20px; }
  .rb-item { grid-template-columns: 40px minmax(0, 1fr); }
  .rb-item .rv-thumb { width: 40px; height: 40px; }
  .rb-item .rb-mini { grid-column: auto; }
  .rb-item .rb-notes { grid-column: 1 / -1; }
  .rb-tools { grid-column: 1 / -1; justify-content: flex-end; }
  .rv-item { grid-template-columns: 46px minmax(0, 1fr) auto; gap: 10px; padding: 11px 12px; }
  .rv-thumb { width: 46px; height: 46px; }
}
.mobile-top { display: none; align-items: center; gap: 12px; margin-bottom: 18px; }
.mobile-top .side-brand { padding: 0; }
