/* Estilo "vidrio líquido" en negro.
   Dirección principal: Liquid Glass de iOS 26 (Refero: Moonlitt 2.0 y Comet):
   fondo negro con profundidad, controles flotantes de cristal, barra inferior en cápsula
   separada con botón redondo a un lado, hojas de cristal.
   Detalles prestados: tarjetas teñidas por métrica (Checker) y anillos de progreso (Kin). */
:root {
  --bg: #04060a;
  --text: #ffffff;
  --soft: rgba(255, 255, 255, .78);
  --muted: rgba(235, 235, 245, .55);
  --dim: rgba(235, 235, 245, .32);
  --line: rgba(255, 255, 255, .09);
  --glass: rgba(255, 255, 255, .065);
  --glass-2: rgba(255, 255, 255, .11);
  --glass-strong: rgba(28, 30, 38, .55);
  --rim: rgba(255, 255, 255, .16);
  --orange: #ff9f0a;
  --green: #30d158;
  --blue: #0a84ff;
  --indigo: #5e5ce6;
  --teal: #64d2ff;
  --pink: #ff375f;
  --yellow: #ffd60a;
  --red: #ff453a;
  --accent: var(--orange);
  --spring: cubic-bezier(.34, 1.4, .5, 1);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); }
html, body { margin: 0; }
body { background: transparent; }
body {
  color: var(--text);
  font: 400 17px/1.35 var(--font);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
  min-height: 100vh;
}
button, label, a { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
svg { display: block; }
b, strong { font-weight: 600; }

/* ---------- Fondo con profundidad (para que el vidrio tenga qué refractar) ---------- */
.ambient { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; background: radial-gradient(120% 80% at 50% 0%, #0b1020 0%, var(--bg) 60%); }
.ambient::before {
  content: ""; position: absolute; inset: 0; opacity: .55;
  background-image:
    radial-gradient(1px 1px at 12% 18%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 78% 9%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 33% 52%, rgba(255,255,255,.7) 50%, transparent 51%),
    radial-gradient(1px 1px at 88% 61%, rgba(255,255,255,.6) 50%, transparent 51%),
    radial-gradient(1px 1px at 52% 83%, rgba(255,255,255,.5) 50%, transparent 51%),
    radial-gradient(1px 1px at 8% 74%, rgba(255,255,255,.6) 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 64% 33%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 23% 92%, rgba(255,255,255,.5) 50%, transparent 51%);
  animation: twinkle 9s ease-in-out infinite alternate;
}
.orb { position: absolute; border-radius: 50%; filter: blur(80px); opacity: .24; will-change: transform; }
.orb.o1 { width: 360px; height: 360px; left: -120px; top: -60px; background: #ff7a1a; animation: drift1 38s ease-in-out infinite alternate; }
.orb.o2 { width: 320px; height: 320px; right: -140px; top: 240px; background: #5b4dff; animation: drift2 44s ease-in-out infinite alternate; }
.orb.o3 { width: 280px; height: 280px; left: 10%; bottom: -120px; background: #00b3a4; opacity: .16; animation: drift3 50s ease-in-out infinite alternate; }
@keyframes drift1 { to { transform: translate(120px, 160px) scale(1.15); } }
@keyframes drift2 { to { transform: translate(-140px, 120px) scale(.9); } }
@keyframes drift3 { to { transform: translate(160px, -200px) scale(1.2); } }
@keyframes twinkle { to { opacity: .25; } }

/* ---------- Vidrio líquido ---------- */
.glass, .card.box, .tile, .alert, .btn.plain, .chip, .seg, .tabbar, .fab, .icon-btn, .sheet, .toast, .daynav button, .counter button, .stat, .food, input, textarea, select {
  background: var(--glass);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  backdrop-filter: blur(22px) saturate(180%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), inset 0 -1px 0 rgba(255, 255, 255, .03), 0 8px 28px rgba(0, 0, 0, .35);
  position: relative;
}
/* Borde de luz (reflejo especular) */
.glass::after, .card.box::after, .tile::after, .tabbar::after, .fab::after, .icon-btn::after, .sheet::after, .chip::after, .seg::after, .alert::after, .stat::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; padding: 1px;
  background: linear-gradient(140deg, rgba(255,255,255,.42), rgba(255,255,255,.06) 32%, rgba(255,255,255,0) 55%, rgba(255,255,255,.1) 80%, rgba(255,255,255,.28));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}

/* Respuesta al toque: se hunde y rebota */
button, label.btn, .tile, .chip { transition: transform .35s var(--spring), background .25s ease, opacity .2s; }
button:active, label.btn:active, .tile:active { transform: scale(.96); }

input, textarea, select {
  font: inherit; font-size: 17px; color: var(--text); border: 0; border-radius: 18px;
  padding: 14px 16px; width: 100%; outline: none; box-shadow: inset 0 1px 0 rgba(255,255,255,.1);
}
input::placeholder, textarea::placeholder { color: var(--dim); }
input:focus, textarea:focus, select:focus { box-shadow: inset 0 0 0 1.5px var(--accent), 0 0 0 4px rgba(255, 159, 10, .15); }
input[type="date"], input[type="time"] { color-scheme: dark; }
select option { background: #15171d; }
textarea { resize: none; min-height: 96px; }

#view {
  max-width: 560px; margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 14px) 16px calc(env(safe-area-inset-bottom) + 120px);
}

/* ---------- Entrada de pantalla (solo al cambiar de pestaña) ---------- */
#view.enter > * { animation: rise .6s var(--ease) both; }
#view.enter > *:nth-child(2) { animation-delay: .04s; }
#view.enter > *:nth-child(3) { animation-delay: .08s; }
#view.enter > *:nth-child(4) { animation-delay: .12s; }
#view.enter > *:nth-child(5) { animation-delay: .16s; }
#view.enter > *:nth-child(6) { animation-delay: .2s; }
#view.enter > *:nth-child(n+7) { animation-delay: .24s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.985); filter: blur(6px); } }

/* ---------- Encabezado ---------- */
.topbar { display: flex; align-items: center; gap: 10px; margin: 2px 0 18px; }
.topbar .ctx { flex: 1; min-width: 0; color: var(--muted); font-size: 15px; font-weight: 500; }
.ring { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; flex: none; color: var(--text); }
.ring svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ring.sm { width: 42px; height: 42px; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; flex: none; color: var(--text); }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 4px 0 22px; }
.head h1 { font-size: 34px; line-height: 1.08; letter-spacing: -.02em; margin: 0; font-weight: 700; text-wrap: balance; }
.head .sub { color: var(--muted); font-size: 15px; margin-top: 6px; font-weight: 500; }
.hello { padding-bottom: .08em; background: linear-gradient(90deg, #fff 0%, #fff 55%, rgba(255,255,255,.55) 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- Tarjetas ---------- */
.card { margin: 0 0 26px; }
.card.box { border-radius: 28px; padding: 18px; margin-bottom: 14px; }
.card h2 {
  font-size: 20px; font-weight: 700; letter-spacing: -.01em; color: var(--text);
  margin: 0 0 12px; display: flex; justify-content: space-between; align-items: center; gap: 10px;
}
.card h2 .link { font-size: 16px; font-weight: 500; color: var(--accent); letter-spacing: 0; }
.empty { color: var(--muted); font-size: 16px; padding: 4px 2px; }
.big { font-size: 40px; font-weight: 700; letter-spacing: -.02em; line-height: 1.05; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.row { display: flex; align-items: center; gap: 12px; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.gap { height: 12px; }

/* Lista dentro de un panel de cristal */
.list { border-radius: 24px; overflow: hidden; }
.card > .list, .card > div > .list { background: var(--glass); -webkit-backdrop-filter: blur(22px) saturate(180%); backdrop-filter: blur(22px) saturate(180%); box-shadow: inset 0 1px 0 rgba(255,255,255,.12); padding: 2px 16px; }
.sheet .list { background: rgba(255,255,255,.05); padding: 2px 14px; }

/* ---------- Avisos ---------- */
.alert { border-radius: 22px; padding: 14px 16px; margin-bottom: 10px; font-size: 15px; display: flex; gap: 12px; align-items: flex-start; color: var(--soft); }
.alert b { display: block; color: var(--text); font-weight: 600; font-size: 16px; margin-bottom: 1px; }
.alert .dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 6px; flex: none; box-shadow: 0 0 12px currentColor; }
.alert.ok .dot { background: var(--green); color: var(--green); }
.alert.warn .dot { background: var(--orange); color: var(--orange); }
.alert.bad .dot { background: var(--red); color: var(--red); }
.alert.bad { background: rgba(255, 69, 58, .12); }

/* ---------- Anillos (Kin) ---------- */
.rings-card { display: flex; align-items: center; gap: 18px; }
.rings { width: 132px; height: 132px; flex: none; position: relative; }
.rings svg { width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.rings circle { fill: none; stroke-linecap: round; }
.rings .trk { stroke: rgba(255, 255, 255, .08); }
.rings .val { transition: stroke-dashoffset 1.2s var(--ease); filter: drop-shadow(0 0 6px currentColor); }
.rings .kc { stroke: url(#gKcal); color: rgba(255, 140, 20, .6); }
.rings .pr { stroke: url(#gProt); color: rgba(48, 209, 88, .55); }
.rings-legend { flex: 1; min-width: 0; display: grid; gap: 12px; }
.rings-legend .k { font-size: 13px; color: var(--muted); font-weight: 600; letter-spacing: .02em; display: flex; align-items: center; gap: 6px; }
.rings-legend .k i { width: 8px; height: 8px; border-radius: 50%; }
.rings-legend .v { font-size: 26px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.rings-legend .v span { font-size: 15px; color: var(--muted); font-weight: 500; letter-spacing: 0; }

/* ---------- Medidores ---------- */
.meter { margin: 4px 0 16px; }
.meter:last-child { margin-bottom: 2px; }
.meter .lbl { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; color: var(--muted); font-size: 15px; }
.meter .lbl b { font-size: 24px; font-weight: 700; color: var(--text); margin-right: 3px; }
.bar { height: 8px; background: rgba(255, 255, 255, .08); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #ff6a00, var(--orange)); box-shadow: 0 0 12px rgba(255, 159, 10, .5); transition: width .9s var(--ease); }
.bar.p i { background: linear-gradient(90deg, #1fa84a, var(--green)); box-shadow: 0 0 12px rgba(48, 209, 88, .45); }
.bar.over i { background: linear-gradient(90deg, #ff2d55, var(--red)); }

/* ---------- Mosaicos teñidos (Checker) ---------- */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile { border-radius: 26px; padding: 14px; text-align: left; min-height: 128px; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; background: color-mix(in srgb, var(--c) 18%, rgba(255,255,255,.04)); }
.tile::before { content: ""; position: absolute; width: 120px; height: 120px; right: -40px; top: -50px; border-radius: 50%; background: var(--c); filter: blur(40px); opacity: .35; }
.tile .ti { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 16px; position: relative; }
.tile .ti svg { width: 20px; height: 20px; stroke: var(--c); fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.tile .tv { position: relative; display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 16px; background: rgba(255,255,255,.08); font-weight: 600; font-size: 15px; }
.tile .tv .tick { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid rgba(255,255,255,.35); flex: none; }
.tile .tv .tick svg { width: 11px; height: 11px; stroke: #000; stroke-width: 3; fill: none; opacity: 0; }
.tile.on .tv { background: color-mix(in srgb, var(--c) 85%, white); color: #000; }
.tile.on .tv .tick { background: #000; border-color: #000; }
.tile.on .tv .tick svg { stroke: color-mix(in srgb, var(--c) 85%, white); opacity: 1; }
.tile .dots { display: flex; gap: 4px; position: relative; }
.tile .dots i { flex: 1; height: 5px; border-radius: 3px; background: rgba(255,255,255,.12); transition: background .4s; }
.tile .dots i.on { background: var(--c); box-shadow: 0 0 8px var(--c); }

/* ---------- Listas ---------- */
.item { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-top: .5px solid var(--line); }
.item:first-child { border-top: 0; }
.item .t { font-weight: 500; font-size: 17px; }
.item .s { color: var(--muted); font-size: 14px; }
.item .end { color: var(--muted); font-size: 15px; text-align: right; white-space: nowrap; }
.x { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: var(--dim); flex: none; }
.x svg { width: 14px; height: 14px; stroke: currentColor; stroke-width: 2.2; fill: none; stroke-linecap: round; }

.check { width: 28px; height: 28px; border-radius: 50%; border: 1.8px solid rgba(255,255,255,.28); display: grid; place-items: center; flex: none; transition: background .3s, border-color .3s, transform .45s var(--spring); }
.check.on { background: var(--green); border-color: var(--green); box-shadow: 0 0 14px rgba(48, 209, 88, .5); animation: pop .5s var(--spring); }
.check svg { width: 14px; height: 14px; stroke: #fff; stroke-width: 3; fill: none; opacity: 0; }
.check.on svg { opacity: 1; }
@keyframes pop { 40% { transform: scale(1.22); } }
.item.done .t { text-decoration: line-through; color: var(--dim); }

.tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 99px; background: rgba(255,255,255,.1); color: var(--soft); white-space: nowrap; }
.tag.exam { background: rgba(255, 159, 10, .18); color: var(--orange); }
.tag.late { background: rgba(255, 69, 58, .2); color: var(--red); }
.sw { width: 10px; height: 10px; border-radius: 50%; flex: none; box-shadow: 0 0 8px currentColor; }
.item .s.row { flex-wrap: wrap; row-gap: 6px; }

/* ---------- Clases ---------- */
.classes { display: grid; gap: 8px; }
.class { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 20px; background: var(--glass); -webkit-backdrop-filter: blur(22px); backdrop-filter: blur(22px); box-shadow: inset 0 1px 0 rgba(255,255,255,.1); }
.class .time { font-variant-numeric: tabular-nums; font-size: 14px; color: var(--muted); width: 96px; flex: none; font-weight: 500; }
.class .bar-l { width: 4px; align-self: stretch; border-radius: 4px; }
.class.now { background: color-mix(in srgb, var(--c, #ff9f0a) 22%, rgba(255,255,255,.05)); box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 0 0 1px color-mix(in srgb, var(--c, #ff9f0a) 45%, transparent), 0 10px 30px color-mix(in srgb, var(--c, #ff9f0a) 25%, transparent); }
.class.now .time { color: var(--text); }
.class.now .time::after { content: "AHORA"; display: block; font-size: 10px; letter-spacing: .12em; color: var(--c, var(--orange)); font-weight: 700; }

/* ---------- Botones ---------- */
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 15px; border-radius: 99px; background: linear-gradient(180deg, #ffb340, #ff8a00); color: #1a0d00; font-weight: 700; font-size: 17px; box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 8px 24px rgba(255, 140, 0, .35); }
.btn.soft, .btn.plain { background: var(--glass-2); color: var(--text); font-weight: 600; }
.btn.danger { background: rgba(255, 69, 58, .14); color: var(--red); box-shadow: none; font-weight: 600; }
.btn.sm { width: auto; padding: 10px 16px; font-size: 15px; }
.btns { display: flex; gap: 10px; }
.btns > * { flex: 1; }
a.btn { text-decoration: none; }

/* Pestañas internas: cápsula de vidrio con gota que se desliza */
.seg { display: flex; border-radius: 99px; padding: 4px; margin: 0 0 22px; }
.seg .drop { position: absolute; top: 4px; bottom: 4px; left: 0; border-radius: 99px; background: rgba(255,255,255,.16); box-shadow: inset 0 1px 0 rgba(255,255,255,.25); transition: transform .55s var(--spring), width .55s var(--spring); }
.seg button { position: relative; z-index: 1; flex: 1; padding: 8px 4px; border-radius: 99px; font-size: 14.5px; font-weight: 600; color: var(--muted); transition: color .3s; }
.seg button.on { color: var(--text); }
.seg button:active { transform: none; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 9px 14px; border-radius: 99px; font-size: 15px; font-weight: 500; display: inline-flex; align-items: center; gap: 7px; color: var(--text); }
.chip.on { background: rgba(255,255,255,.92); color: #000; }
.chips.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.chips.days .chip { justify-content: center; padding: 9px 0; font-size: 14px; }

/* ---------- Dieta ---------- */
.meal-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
.meal-head h3 { margin: 0; font-size: 20px; font-weight: 700; }
.add-line { color: var(--accent); padding: 12px 2px 0; display: flex; gap: 6px; align-items: center; font-size: 16px; font-weight: 600; }
.add-line svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 2.4; fill: none; stroke-linecap: round; }
.foods { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.food { text-align: left; border-radius: 20px; padding: 12px 14px; }
.food .t { font-size: 15px; font-weight: 600; line-height: 1.25; }
.food .s { color: var(--muted); font-size: 13px; margin-top: 3px; }
.daynav { display: flex; align-items: center; justify-content: space-between; margin: -6px 0 18px; }
.daynav button { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; }
.daynav svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2.2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.daynav .d { font-size: 17px; font-weight: 600; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { border-radius: 20px; padding: 12px; }
.stat .v { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.stat .k { font-size: 12px; color: var(--muted); font-weight: 500; }
.chart { width: 100%; height: auto; margin-top: 14px; overflow: visible; }
.chart .ln { fill: none; stroke: var(--orange); stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; filter: drop-shadow(0 0 6px rgba(255, 159, 10, .6)); stroke-dasharray: 1000; stroke-dashoffset: 1000; animation: draw 1.6s var(--ease) forwards; }
.chart .ar { fill: rgba(255, 159, 10, .1); }
.chart .pt { fill: #0b0d12; stroke: var(--orange); stroke-width: 2; }
.chart text { fill: var(--muted); font-size: 10px; font-family: var(--font); }
.chart .grid { stroke: var(--line); }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* ---------- Gym ---------- */
.ex { padding: 14px 0; border-top: .5px solid var(--line); }
.ex:first-child { border-top: 0; padding-top: 4px; }
.ex .name { font-size: 18px; font-weight: 600; }
.sets { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.set { font-size: 13px; font-weight: 600; padding: 5px 11px; border-radius: 99px; background: rgba(255,255,255,.1); }
.set.pr { background: rgba(48, 209, 88, .2); color: var(--green); }
.ex-in { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; }
.ex-in input { padding: 11px 14px; }

/* ---------- Hábitos ---------- */
.habit { padding: 16px 0; border-top: .5px solid var(--line); }
.habit:first-child { border-top: 0; padding-top: 6px; }
.habit .ring { color: var(--c, #fff); background: color-mix(in srgb, var(--c, #fff) 18%, transparent); }
.counter { display: flex; align-items: center; gap: 8px; }
.counter button { width: 36px; height: 36px; border-radius: 50%; font-size: 20px; font-weight: 500; display: grid; place-items: center; }
.counter .n { min-width: 60px; text-align: center; font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }
.week { display: flex; gap: 6px; margin-top: 12px; }
.week span { flex: 1; text-align: center; font-size: 11px; color: var(--dim); font-weight: 500; }
.week i { display: block; height: 6px; border-radius: 4px; background: rgba(255,255,255,.08); margin-bottom: 5px; }
.week i.on { background: var(--c, var(--green)); box-shadow: 0 0 8px var(--c, var(--green)); }
.streak { font-size: 13px; color: var(--c, var(--orange)); font-weight: 600; }

/* ---------- Cuaderno ---------- */
.thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.thumbs button { position: relative; aspect-ratio: 3 / 4; border-radius: 18px; overflow: hidden; background: var(--glass); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumbs i { position: absolute; right: 6px; bottom: 6px; font-style: normal; font-size: 12px; background: rgba(0,0,0,.6); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); color: #fff; border-radius: 99px; padding: 1px 7px; }
.thumb-sm { width: 46px; height: 46px; border-radius: 14px; object-fit: cover; flex: none; display: block; }
.photo-full { width: 100%; border-radius: 22px; display: block; max-height: 62vh; object-fit: contain; background: #000; }
.photo-prev { width: 100%; border-radius: 18px; margin-top: 8px; display: block; }

/* ---------- Hoja de cristal ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet-wrap[hidden] { display: none; }
.sheet-bg { position: absolute; inset: 0; background: rgba(0, 0, 0, .45); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); animation: fade .3s ease; }
.sheet {
  width: calc(100% - 12px); max-width: 548px; max-height: 90vh; overflow-y: auto; margin-bottom: 6px;
  background: var(--glass-strong); -webkit-backdrop-filter: blur(40px) saturate(190%); backdrop-filter: blur(40px) saturate(190%);
  border-radius: 34px; padding: 8px 18px calc(env(safe-area-inset-bottom) + 18px);
  animation: sheetUp .55s var(--spring);
}
.grabber { width: 38px; height: 5px; border-radius: 3px; background: rgba(255,255,255,.3); margin: 0 auto 14px; }
.sheet h3 { margin: 0 0 16px; font-size: 24px; font-weight: 700; letter-spacing: -.01em; text-wrap: balance; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 7px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@keyframes sheetUp { from { transform: translateY(110%) scale(.96); opacity: .6; } }
@keyframes fade { from { opacity: 0; } }

.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 96px);
  padding: 11px 18px; border-radius: 99px; font-size: 15px; font-weight: 600; z-index: 30; white-space: nowrap;
  background: rgba(40, 42, 50, .6); animation: toastIn .5s var(--spring); transform: translateX(-50%);
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 16px) scale(.9); } }

/* ---------- Barra inferior: cápsula de cristal + botón redondo (Comet / iOS 26) ---------- */
.dock { position: fixed; left: 0; right: 0; bottom: calc(env(safe-area-inset-bottom) + 10px); z-index: 10; display: flex; justify-content: center; align-items: center; gap: 10px; padding: 0 12px; pointer-events: none; }
.dock > * { pointer-events: auto; }
.tabbar { display: flex; align-items: center; border-radius: 99px; padding: 5px; background: rgba(30, 32, 40, .5); }
.tabbar .drop { position: absolute; top: 5px; bottom: 5px; left: 0; border-radius: 99px; background: rgba(255,255,255,.14); box-shadow: inset 0 1px 0 rgba(255,255,255,.28), inset 0 -1px 0 rgba(255,255,255,.06); transition: transform .6s var(--spring), width .6s var(--spring); }
.tabbar button { position: relative; z-index: 1; width: 58px; padding: 6px 0 5px; display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--muted); font-size: 10px; font-weight: 600; border-radius: 99px; transition: color .3s; }
.tabbar button svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform .45s var(--spring); }
.tabbar button.on { color: var(--accent); }
.tabbar button.on svg { transform: scale(1.08); }
.tabbar button:active { transform: none; }
.fab { width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; color: var(--text); background: rgba(30, 32, 40, .5); flex: none; }
.fab svg { width: 24px; height: 24px; stroke: currentColor; stroke-width: 2.2; fill: none; stroke-linecap: round; }
.fab.live { color: var(--c); box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 0 0 1px color-mix(in srgb, var(--c) 50%, transparent), 0 0 26px color-mix(in srgb, var(--c) 45%, transparent); }
.fab.live::before { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 1.5px solid var(--c); opacity: 0; animation: pulse 2.8s ease-out infinite; }
@keyframes pulse { 0% { opacity: .6; transform: scale(.9); } 100% { opacity: 0; transform: scale(1.25); } }
@media (max-width: 370px) { .tabbar button { width: 52px; } .fab { width: 54px; height: 54px; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- Arreglos para iPhone: nada se mueve de lado ---------- */
html, body { overflow-x: hidden; max-width: 100%; }
body.locked { position: fixed; left: 0; right: 0; width: 100%; overflow: hidden; }
.sheet-wrap { overscroll-behavior: contain; }
.sheet-bg { touch-action: none; }
.sheet { overflow-x: hidden; overscroll-behavior: contain; touch-action: pan-y; -webkit-overflow-scrolling: touch; }
.sheet * { max-width: 100%; }
/* En iPhone los campos de fecha y hora se hacen más anchos que la pantalla: se fijan al ancho */
input[type="date"], input[type="time"] {
  -webkit-appearance: none; appearance: none; display: block;
  min-width: 0; max-width: 100%; width: 100%; min-height: 50px; text-align: left;
}
input[type="date"]::-webkit-date-and-time-value, input[type="time"]::-webkit-date-and-time-value { text-align: left; }
.two > * { min-width: 0; }

/* X para cerrar la ventana: siempre visible arriba a la derecha */
.sheet-x {
  position: sticky; top: 0; float: right; z-index: 3; margin: -6px -4px 6px 10px;
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: var(--text);
  background: rgba(255, 255, 255, .14); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25);
}
.sheet-x svg { width: 15px; height: 15px; stroke: currentColor; stroke-width: 2.4; fill: none; stroke-linecap: round; }
.sheet-x + h3, .sheet-x + * { margin-top: 0; }
/* La ventana se desplaza: su brillo de borde va como sombra, no como capa (evitaba una raya al bajar) */
.sheet::after { display: none; }
.sheet { box-shadow: inset 0 1px 0 rgba(255,255,255,.22), inset 0 0 0 1px rgba(255,255,255,.08), 0 -10px 40px rgba(0,0,0,.45); }
.field label.btn { display: flex; font-size: 16px; font-weight: 600; color: var(--text); margin: 0; }
