/* GlucoApp · estilos de cuentas, cobros y modo profesional (usa los mismos tokens de la app) */

/* Pantalla de carga mientras revisamos la sesión */
html.cloud-boot .screens, html.cloud-boot nav { visibility: hidden; }
html.cloud-boot body::after { content: ""; position: fixed; inset: 0; z-index: 200; background: var(--bg) url(icons/icon-192.png) center / 84px no-repeat; }

/* Paciente vs profesional */
#proNav { display: none; grid-template-columns: repeat(2, 1fr); }
.is-pro #patNav { display: none; }
.is-pro #proNav { display: grid; }
.is-pro .only-patient { display: none !important; }
.viewing #proNav { display: none; }
.viewing #patNav { display: grid; }
.viewing #patNav .fab, .viewing #patNav [data-v="tutor"] { visibility: hidden; }
.viewing #accessCard, .viewing #notesCard, .viewing #coachCard, .viewing #planAIBox { display: none !important; }
.viewing .vin { padding-bottom: calc(170px + env(safe-area-inset-bottom, 0px)); }

/* Entrar / crear cuenta */
.auth { position: fixed; inset: 0; z-index: 90; overflow-y: auto; background: var(--bg); overscroll-behavior: contain; }
.auth-in { max-width: 440px; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; gap: 18px;
  padding-top: calc(env(safe-area-inset-top, 0px) + 40px); padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 24px);
  padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px)); }
.brand { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; }
.brand img { border-radius: 20px; box-shadow: 0 12px 30px -12px rgba(30, 33, 96, .5); }
.brand h1 { font-family: var(--display); font-weight: 800; font-size: 2rem; letter-spacing: -.03em; margin: 6px 0 0; }
.brand p { margin: 0; color: var(--muted); }
.auth-form { display: flex; flex-direction: column; gap: 14px; background: var(--surface); border-radius: 24px; padding: 20px; box-shadow: 0 1px 0 var(--line), 0 10px 30px -18px rgba(20, 20, 60, .35); }
.a-title { font-family: var(--display); font-size: 1.4rem; margin: 0; }
.chk { display: flex; gap: 10px; align-items: flex-start; font-size: .92rem; line-height: 1.4; cursor: pointer; }
.chk input { width: 22px; height: 22px; min-height: 0; flex: none; margin-top: 1px; accent-color: var(--accent); }
.chk a, .a-msg a { color: var(--accent); font-weight: 700; }
.a-msg { background: var(--surface); border-radius: 24px; padding: 22px; display: flex; flex-direction: column; gap: 10px; }
.a-msg h2 { font-family: var(--display); margin: 0; }
.a-msg p { margin: 0; }
.a-foot { color: var(--muted); font-size: .8rem; text-align: center; margin: auto 0 0; }
textarea { font: inherit; font-size: max(16px, 1em); width: 100%; padding: 12px 14px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--bg); color: var(--ink); resize: vertical; margin-top: 6px; }

/* Avisos de acceso */
.acc { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 20px; }
.acc > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.acc b { font-family: var(--display); font-size: 1.05rem; }
.acc span { font-size: .9rem; color: var(--muted); }
.acc.trial { background: var(--accent-soft); }
.acc.off { background: var(--warn-soft); }

/* Hoja de pago */
.pay-lead { margin: 0 0 6px; color: var(--muted); }
.price { display: flex; align-items: baseline; gap: 8px; margin: 4px 0 10px; }
.price b { font-family: var(--display); font-weight: 800; font-size: 2.6rem; letter-spacing: -.03em; }
.price span { color: var(--muted); font-weight: 700; }
.perks { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.perks li { display: flex; gap: 10px; align-items: flex-start; }
.perks li::before { content: "✓"; flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: grid; place-items: center; font-weight: 800; font-size: .8rem; margin-top: 1px; }
.btn.mp { background: #009EE3; color: #fff; }

/* Indicaciones */
.notes .note { padding: 12px 14px; border-radius: 16px; background: var(--accent-soft); display: flex; flex-direction: column; gap: 4px; }
.notes .note + .note { margin-top: 8px; }
.notes .note p { margin: 0; font-weight: 700; }
.li.lnk { text-decoration: none; color: var(--muted); border-left: 0; border-right: 0; border-bottom: 0; background: none; width: 100%; font: inherit; cursor: pointer; }

/* Profesional */
.code-card { display: flex; flex-direction: column; gap: 8px; }
.code { font-family: var(--display); font-weight: 800; font-size: 2.4rem; letter-spacing: .18em; font-variant-numeric: tabular-nums; user-select: all; }
.plist { display: flex; flex-direction: column; }
.prow { display: flex; align-items: center; gap: 12px; padding: 12px 0; border: 0; border-top: 1px solid var(--line); background: none; color: var(--ink); text-align: left; font: inherit; width: 100%; transition: transform 120ms var(--ease-out); }
.prow:first-child { border-top: 0; }
.prow:active { transform: scale(.98); }
.prow > svg { width: 20px; height: 20px; color: var(--muted); flex: none; }
.av { width: 46px; height: 46px; border-radius: 50%; flex: none; display: grid; place-items: center; color: #fff; font-weight: 800; font-family: var(--display); }
.av.sm { width: 36px; height: 36px; font-size: .85rem; }
.pm { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.pm b { font-family: var(--display); font-size: 1.05rem; }
.pl { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl .dot { width: 9px; height: 9px; }
.pcs { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.pc { font-size: .74rem; font-weight: 800; padding: 2px 8px; border-radius: 999px; background: var(--bg); color: var(--muted); }
.pc.bad { background: var(--bad-soft); color: var(--bad); }
.pc.warn { background: var(--warn-soft); color: var(--warn); }
.pc.ok { background: var(--ok-soft); color: var(--ok); }
.pc.acc { background: var(--accent-soft); color: var(--accent); }
.empty { text-align: center; padding: 18px 6px; }
.empty b { font-family: var(--display); font-size: 1.1rem; }

/* Barra flotante al ver a un paciente */
.view-pill { position: fixed; z-index: 25; left: 50%; transform: translateX(-50%); bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  width: min(520px, calc(100% - 24px)); display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 22px;
  background: var(--ink); color: var(--bg); box-shadow: 0 14px 30px -12px rgba(0, 0, 0, .5); }
.vp-x { width: 40px; height: 40px; border-radius: 14px; border: 0; background: color-mix(in srgb, var(--bg) 16%, transparent); color: inherit; display: grid; place-items: center; flex: none; }
.vp-x svg { width: 22px; height: 22px; }
.vp-t { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.vp-t b { font-family: var(--display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vp-t span { font-size: .78rem; opacity: .7; }
.vp-b { border: 0; border-radius: 14px; background: var(--accent); color: #fff; font-weight: 800; padding: 0 14px; min-height: 40px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .vp-b { color: #06102a; } }

/* Administración */
body:not(.is-admin) .only-admin { display: none !important; }
.admin-entry { display: flex; align-items: center; gap: 14px; width: 100%; border: 0; text-align: left; font: inherit; color: var(--ink); cursor: pointer;
  background: linear-gradient(135deg, var(--accent-soft), var(--surface) 70%); transition: transform 140ms var(--ease-out); }
.admin-entry:active { transform: scale(.98); }
.ae-ic { width: 46px; height: 46px; border-radius: 14px; background: var(--accent); color: #fff; display: grid; place-items: center; flex: none; }
.ae-ic svg { width: 24px; height: 24px; }
.ae-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ae-t b { font-family: var(--display); font-size: 1.08rem; }
.ae-t span { color: var(--muted); font-size: .88rem; }
.ae-ch { width: 20px; height: 20px; color: var(--muted); flex: none; }
.adm-kpis { display: flex; flex-direction: column; gap: 12px; }
.adm-hero { position: relative; overflow: hidden; border-radius: 26px; padding: 22px 20px; color: #fff; display: flex; flex-direction: column; gap: 4px;
  background: radial-gradient(120% 120% at 100% 0%, #6B68F0 0%, #3D3BB8 45%, #1E2160 100%); box-shadow: 0 18px 40px -20px rgba(30, 33, 96, .8); }
.adm-hero::after { content: ""; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; border-radius: 50%; border: 18px solid rgba(255, 255, 255, .08); }
.adm-hl { font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; opacity: .8; }
.adm-hero b { font-family: var(--display); font-weight: 800; font-size: 2.8rem; line-height: 1.05; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.adm-hs { font-size: .92rem; opacity: .85; }
.adm-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 520px) { .adm-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.adm-tile { background: var(--surface); border-radius: 20px; padding: 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0;
  box-shadow: 0 1px 0 var(--line), 0 10px 26px -20px rgba(20, 20, 60, .45); }
.adm-tile b { font-family: var(--display); font-weight: 800; font-size: 1.8rem; line-height: 1.1; font-variant-numeric: tabular-nums; margin-top: 8px; }
.adm-l { font-weight: 700; font-size: .9rem; }
.adm-s { color: var(--muted); font-size: .78rem; }
.adm-ic { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; }
.adm-ic svg { width: 20px; height: 20px; }
.adm-ic.acc { background: var(--accent-soft); color: var(--accent); }
.adm-ic.ok { background: var(--ok-soft); color: var(--ok); }
.adm-ic.warn { background: var(--warn-soft); color: var(--warn); }
.adm-ic.bad { background: var(--bad-soft); color: var(--bad); }
.adm-ic.pink { background: color-mix(in srgb, var(--prot) 18%, transparent); color: var(--prot); }
.adm-ic.mute { background: var(--bg); color: var(--muted); }
.adm-funnel { background: var(--surface); border-radius: 24px; padding: 18px; box-shadow: 0 1px 0 var(--line), 0 10px 30px -18px rgba(20, 20, 60, .35); }
.adm-bar { display: flex; gap: 4px; height: 14px; }
.adm-bar i { display: block; border-radius: 7px; min-width: 8px; }
.adm-leg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; margin-top: 12px; font-size: .88rem; }
.adm-leg span { display: flex; align-items: center; gap: 8px; min-width: 0; }
.adm-leg span i { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.adm-leg b { font-variant-numeric: tabular-nums; }
.adm-leg em { font-style: normal; color: var(--muted); margin-left: auto; font-variant-numeric: tabular-nums; }
.adm-bar .pay, .adm-leg .pay { background: var(--ok); }
.adm-bar .trial, .adm-leg .trial { background: var(--warn); }
.adm-bar .gift, .adm-leg .gift { background: var(--prot); }
.adm-bar .off, .adm-leg .off { background: var(--line); }
.adm-plan { display: flex; flex-direction: column; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); }
.adm-plan:first-child { border-top: 0; padding-top: 0; }
.adm-plan > b { font-family: var(--display); font-size: 1.05rem; }
.adm-pf { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.adm-acts { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.btn.danger { color: var(--bad); background: var(--bad-soft); }

/* Planes */
.plans { display: flex; flex-direction: column; gap: 12px; margin: 6px 0 4px; }
.plan-card { position: relative; border: 1.5px solid var(--line); border-radius: 22px; padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.plan-card.best { border-color: var(--accent); background: linear-gradient(160deg, var(--accent-soft), var(--surface) 70%); }
.plan-n { font-family: var(--display); font-size: 1.2rem; }
.plan-tag { position: absolute; top: 14px; right: 14px; font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; padding: 4px 10px; border-radius: 999px; background: var(--accent); color: #fff; }
.plan-card .price { margin: 2px 0 6px; }
.plan-card .price b { font-size: 2rem; }
.plan-card .perks { margin: 0 0 12px; }
.pc.mute { background: var(--bg); color: var(--muted); }

/* Candados: en Gratis se ve borroso lo que es de Básico (no aplica cuando un consultorio ve a su paciente) */
.gated { position: relative; }
.gated > .unlock { display: none; }
body.tier-gratis:not(.viewing) .gated > :not(.head):not(.unlock) { filter: blur(6px); opacity: .55; pointer-events: none; user-select: none; }
body.tier-gratis:not(.viewing) .gated { min-height: 190px; overflow: hidden; }
body.tier-gratis:not(.viewing) .gated > .unlock { display: flex; }
.unlock { position: absolute; left: 50%; top: 55%; transform: translate(-50%, -50%); width: min(300px, calc(100% - 32px)); z-index: 2;
  align-items: center; gap: 12px; text-align: left; border: 0; border-radius: 18px; padding: 14px 16px; cursor: pointer; font: inherit;
  background: var(--ink); color: var(--bg); box-shadow: 0 14px 30px -12px rgba(0, 0, 0, .45); }
.unlock svg { width: 26px; height: 26px; flex: none; }
.unlock span { display: flex; flex-direction: column; font-size: .85rem; opacity: .9; }
.unlock b { font-family: var(--display); font-size: 1rem; opacity: 1; }
/* Etiqueta "Plus" en lo que usa IA, cuando no se tiene Plus */
body.tier-gratis #coachCard .head h2::after, body.tier-basico #coachCard .head h2::after,
body.tier-gratis #photoCard .shot b::after, body.tier-basico #photoCard .shot b::after {
  content: "PLUS"; display: inline-block; margin-left: 8px; vertical-align: middle; font-family: var(--body); font-size: .66rem; font-weight: 800; letter-spacing: .08em;
  padding: 3px 8px; border-radius: 999px; background: var(--accent); color: #fff; }
.prow.locked { opacity: .75; }
