:root {
  --bg: #fff1f2;
  --surface: #ffffff;
  --surface2: #ffe4e6;
  --text: #2a1519;
  --muted: #7c5a60;
  --line: #f3c9cf;
  --accent: #e11d48;
  --accent-ink: #ffffff;
  --me: #e11d48;
  --partner: #6d5bd0;
  --period: #f43f5e;
  --fertile: #14b8a6;
  --ovul: #f59e0b;
  --meet: #e11d48;
  --ok: #15803d;
  --hero1: #e11d48;
  --hero2: #b0173a;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(120, 30, 50, 0.08), 0 6px 18px rgba(120, 30, 50, 0.07);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b0f12;
    --surface: #2a171b;
    --surface2: #3a2026;
    --text: #fbe9ec;
    --muted: #c4a0a7;
    --line: #4a2a31;
    --accent: #fb5b7d;
    --accent-ink: #2a0a12;
    --me: #fb7c97;
    --partner: #a99bf5;
    --period: #fb7185;
    --fertile: #2dd4bf;
    --ovul: #fbbf24;
    --meet: #fb5b7d;
    --ok: #4ade80;
    --shadow: none;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
button, a, label, select, summary, .day { touch-action: manipulation; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.45 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; }
body { min-height: 100dvh; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h2 { font-size: 1.15rem; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.hidden { display: none !important; }

#app { max-width: 640px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }
main { flex: 1; padding: 16px 16px calc(84px + env(safe-area-inset-bottom)); display: grid; gap: 14px; align-content: start; }
header.top { padding: calc(14px + env(safe-area-inset-top)) 16px 0; display: flex; align-items: center; justify-content: space-between; }
header.top h1 { font-size: 1.3rem; }
.badge { font-size: 0.72rem; padding: 3px 9px; border-radius: 999px; background: var(--surface2); color: var(--muted); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card h2 { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.big { font-size: 2.4rem; font-weight: 750; letter-spacing: -0.02em; line-height: 1.05; }
.big small { font-size: 1rem; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: grid; gap: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 420px) { .grid2.keep { grid-template-columns: 1fr 1fr; } }

.btn { border: 0; background: var(--accent); color: var(--accent-ink); padding: 11px 16px; border-radius: 12px; font-weight: 650; cursor: pointer; min-height: 44px; }
.btn.ghost { background: var(--surface2); color: var(--text); }
.btn.small { padding: 7px 12px; min-height: 36px; font-size: 0.88rem; }
.btn.danger { background: transparent; color: var(--period); border: 1.5px solid color-mix(in srgb, var(--period) 55%, transparent); margin-left: auto; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn:focus-visible, .tab:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .day:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

label.field { display: grid; gap: 4px; font-size: 0.88rem; color: var(--muted); }
input[type=text], input[type=date], input[type=number], input[type=email], input[type=password], select, textarea { width: 100%; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--text); min-height: 44px; }
input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--accent); }
label.check { display: flex; gap: 10px; align-items: center; min-height: 36px; }

nav.tabs { position: fixed; left: 0; right: 0; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); display: flex; justify-content: center; padding-bottom: env(safe-area-inset-bottom); z-index: 5; }
nav.tabs .in { display: flex; width: 100%; max-width: 640px; }
.tab { flex: 1; border: 0; background: none; padding: 8px 2px 9px; display: grid; gap: 1px; justify-items: center; color: var(--muted); font-size: 0.72rem; cursor: pointer; position: relative; }
.tab .ic { line-height: 1; display: grid; place-items: center; height: 26px; }
.tab[aria-current=page] { color: var(--accent); font-weight: 700; }
.tab .dot { position: absolute; top: 6px; right: calc(50% - 20px); width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }

/* Inicio */
.hero { text-align: center; padding: 20px 16px; background: linear-gradient(135deg, var(--hero1), var(--hero2)); color: #fff; border: 0; }
.hero .big small, .hero .muted { color: rgba(255, 255, 255, 0.85); }
.hero .names { font-weight: 650; margin-bottom: 4px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 0.8rem; background: var(--surface2); }
.chip.period { background: color-mix(in srgb, var(--period) 20%, transparent); color: var(--period); }
.chip.fertile { background: color-mix(in srgb, var(--fertile) 22%, transparent); color: var(--fertile); }
.bar { height: 10px; border-radius: 999px; background: var(--surface2); overflow: hidden; display: flex; }
.bar span { display: block; height: 100%; }

/* Calendario */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal .dow { text-align: center; font-size: 0.72rem; color: var(--muted); padding: 2px 0; }
.day { border: 1.5px solid transparent; background: color-mix(in srgb, var(--surface2) 55%, var(--surface)); border-radius: 10px; padding: 4px 2px 5px; min-height: 52px; display: grid; align-content: space-between; justify-items: center; cursor: pointer; position: relative; font-size: 0.85rem; }
.day.off { opacity: 0.35; }
.day.today { border-color: var(--accent); font-weight: 750; }
.day.sel { background: var(--surface2); border-color: var(--text); }
.day.period { background: color-mix(in srgb, var(--period) 20%, var(--surface)); }
.day.fertile { background: color-mix(in srgb, var(--fertile) 16%, var(--surface)); border-style: dashed; border-color: color-mix(in srgb, var(--fertile) 75%, transparent); }
.day.today { border-style: solid; }
.day .mark { position: absolute; top: 4px; left: 4px; color: var(--period); line-height: 0; }
.day .star { position: absolute; top: 4px; right: 4px; color: var(--accent); line-height: 0; }
.dots { display: flex; gap: 3px; height: 8px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; display: block; }
.dots .me { background: var(--me); }
.dots .pa { background: var(--partner); }
.legend { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; font-size: 0.8rem; color: var(--muted); margin-top: 12px; }
.legend span { display: flex; align-items: center; gap: 6px; }
.lg { width: 10px; height: 10px; border-radius: 50%; flex: none; margin: 0 4px; }
.lg.me { background: var(--me); }
.lg.pa { background: var(--partner); }
.lg-cell { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 5px; flex: none; background: color-mix(in srgb, var(--surface2) 55%, var(--surface)); }
.lg-cell.period { background: color-mix(in srgb, var(--period) 20%, var(--surface)); color: var(--period); }
.lg-cell.fertile { border: 1.5px dashed color-mix(in srgb, var(--fertile) 75%, transparent); background: color-mix(in srgb, var(--fertile) 16%, var(--surface)); }
.lg-cell.star { color: var(--accent); }
.ev { display: grid; grid-template-columns: 4px 1fr; gap: 10px; padding: 6px 0; }
.ev b { display: block; border-radius: 4px; }
.best-item { display: grid; gap: 2px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg); }
.best-item.top { border-color: var(--accent); }

/* Chat */
.chatwrap { display: flex; flex-direction: column; height: calc(100dvh - 190px); min-height: 320px; }
.msgs { flex: 1; overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column; gap: 6px; padding: 4px 2px 8px; overscroll-behavior: contain; }
.msg { position: relative; max-width: 84%; padding: 8px 12px 6px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); overflow-wrap: anywhere;
  touch-action: pan-y; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; transition: transform 0.18s ease, background 0.4s; }
.msg.swiping { transition: none; }
.msg.mine { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-color: transparent; border-bottom-right-radius: 6px; }
.msg:not(.mine) { align-self: flex-start; border-bottom-left-radius: 6px; }
.msg.flash { outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 2px; }
.msg.deleted { font-style: italic; opacity: 0.75; }
.mtext { white-space: pre-wrap; display: block; }
.meta { display: flex; align-items: center; justify-content: flex-end; gap: 4px; font-size: 0.68rem; opacity: 0.8; margin-top: 2px; }
.ticks { display: inline-flex; align-items: center; opacity: 0.85; }
.ticks.read { opacity: 1; color: var(--tick-read, #7dd3fc); }
.swipe-ic { position: absolute; left: -34px; top: 50%; transform: translateY(-50%); width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface2); color: var(--text); opacity: var(--sw, 0); pointer-events: none; }
.quote { display: grid; gap: 1px; padding: 5px 8px; margin: 0 0 5px; border-left: 3px solid currentColor; border-radius: 8px; cursor: pointer; font-size: 0.85rem;
  background: color-mix(in srgb, currentColor 12%, transparent); }
.quote b { font-size: 0.78rem; }
.quote span { opacity: 0.85; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.daysep { align-self: center; margin: 8px 0 4px; }
.daysep span { font-size: 0.72rem; color: var(--muted); background: var(--surface2); padding: 3px 10px; border-radius: 99px; text-transform: capitalize; }
.media { position: relative; border-radius: 12px; overflow: hidden; width: min(260px, 64vw); background: var(--surface2); margin: 0 0 4px; cursor: pointer; }
.media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.media .play { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; background: rgba(0, 0, 0, 0.28); }
.media .dur, .media .gifb { position: absolute; left: 6px; bottom: 6px; font-size: 0.7rem; font-weight: 700; color: #fff; background: rgba(0, 0, 0, 0.55); padding: 1px 6px; border-radius: 6px; }
.uploading .bar { height: 4px; border-radius: 4px; background: color-mix(in srgb, currentColor 30%, transparent); overflow: hidden; margin-top: 4px; }
.uploading .bar span { display: block; height: 100%; background: currentColor; transition: width 0.2s; }
.ctxbar { display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin-top: 8px; border-radius: 12px; background: var(--surface2); border-left: 3px solid var(--accent); }
.ctxbar > div { flex: 1; min-width: 0; display: grid; font-size: 0.85rem; }
.ctxbar > div span { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ctx-ic { color: var(--accent); display: grid; }
.composer { display: flex; gap: 8px; padding-top: 8px; align-items: center; }
.composer input[type=text] { flex: 1; min-width: 0; }
.iconbtn { border: 0; background: var(--surface2); color: var(--text); width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; cursor: pointer; flex: none; }
.iconbtn.flat { background: none; width: 36px; height: 36px; }
.sendbtn { width: 44px; padding: 0; display: grid; place-items: center; flex: none; }
:root[data-theme=dark] { --tick-read: #075985; }
:root[data-theme=light] { --tick-read: #7dd3fc; }

/* Menú de un mensaje y visor de archivos */
.sheet-back { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); display: flex; align-items: flex-end; justify-content: center; z-index: 30; animation: fadein 0.15s both; }
.sheet { width: min(640px, 100%); background: var(--surface); border-radius: 22px 22px 0 0; padding: 12px 12px calc(14px + env(safe-area-inset-bottom)); display: grid; gap: 4px; }
.sheet-preview { padding: 6px 10px 10px; color: var(--muted); font-size: 0.88rem; border-bottom: 1px solid var(--line); margin-bottom: 4px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sheet-item { display: flex; align-items: center; gap: 14px; border: 0; background: none; color: var(--text); text-align: left; padding: 13px 10px; border-radius: 12px; font-size: 1rem; cursor: pointer; min-height: 48px; }
.sheet-item:active { background: var(--surface2); }
.sheet-item.danger { color: var(--period); }
.viewer { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.92); z-index: 40; display: grid; place-items: center; }
.vbody { max-width: 100vw; max-height: 100dvh; display: grid; place-items: center; color: #fff; text-align: center; }
.vbody img, .vbody video { max-width: 100vw; max-height: 86dvh; object-fit: contain; }
.vthumb { filter: blur(2px); opacity: 0.7; }
.vmsg { margin: 8px 0 0; font-size: 0.9rem; }
.vclose { position: absolute; top: calc(10px + env(safe-area-inset-top)); right: 10px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, 0.16); color: #fff; display: grid; place-items: center; cursor: pointer; z-index: 2; }

/* Series */
.show { display: grid; grid-template-columns: 64px 1fr; gap: 12px; align-items: start; padding: 14px 0; border-top: 1px solid var(--line); }
.show:first-of-type { border-top: 0; }
.show .ep { font-weight: 750; font-size: 1.15rem; color: var(--accent); }
.plat { font-size: 0.72rem; padding: 2px 8px; border-radius: 6px; background: var(--surface2); color: var(--muted); margin-left: 6px; }

/* Bienvenida */
.welcome { padding: 28px 18px; display: grid; gap: 18px; align-content: center; min-height: 100dvh; }
.welcome h1 { font-size: 2rem; }
.code { font-size: 2rem; letter-spacing: 0.25em; font-weight: 800; text-align: center; padding: 12px; background: var(--surface2); border-radius: 14px; user-select: all; }

#toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; opacity: 0; pointer-events: none; transition: 0.25s; max-width: 90vw; z-index: 20; }
#toast.on { opacity: 1; transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) { #toast { transition: none; } }

/* Selector de dos opciones (crear cuenta / iniciar sesión) */
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface2); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { border: 0; background: none; padding: 10px; border-radius: 9px; font-weight: 650; color: var(--muted); cursor: pointer; min-height: 40px; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* Íconos */
svg.ic { flex: none; vertical-align: -0.2em; }
.card h2 svg { color: var(--accent); }
header.top h1 { display: flex; align-items: center; gap: 8px; }
header.top h1 svg { color: var(--accent); }
.chip svg { vertical-align: -0.15em; }
.empty-ic { display: grid; place-items: center; color: var(--muted); margin-bottom: 6px; }

/* Pantalla de carga */
.splash { min-height: 100dvh; display: grid; place-content: center; justify-items: center; gap: 22px; padding: 32px; text-align: center; }
.splash-logo { width: 92px; height: 92px; border-radius: 28px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--hero1), var(--hero2)); box-shadow: 0 12px 32px color-mix(in srgb, var(--hero1) 38%, transparent);
  animation: beat 1.7s ease-in-out infinite; }
.logo-sm { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; color: #fff; margin-bottom: 14px;
  background: linear-gradient(135deg, var(--hero1), var(--hero2)); }
.splash h1 { font-size: 1.9rem; letter-spacing: -0.02em; }
.loadbar { width: 120px; height: 4px; border-radius: 99px; background: var(--surface2); overflow: hidden; position: relative; }
.loadbar::after { content: ''; position: absolute; inset: 0; width: 40%; border-radius: 99px; background: var(--accent); animation: slide 1.3s ease-in-out infinite; }
.tip { max-width: 300px; min-height: 5.4em; }
.tip small { display: block; text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.7rem; color: var(--accent); font-weight: 700; margin-bottom: 6px; }
.tip p { margin: 0; color: var(--muted); transition: opacity 0.35s; animation: fadein 0.6s both; }
.tip p.out { opacity: 0; }
@keyframes beat { 0%, 100% { transform: scale(1); } 14% { transform: scale(1.09); } 28% { transform: scale(1); } 42% { transform: scale(1.06); } }
@keyframes slide { 0% { transform: translateX(-110%); } 100% { transform: translateX(280%); } }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .splash-logo, .loadbar::after, .tip p { animation: none; }
  .loadbar::after { width: 100%; }
}

/* Apariencia */
.seg3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; background: var(--surface2); border-radius: 12px; padding: 4px; }
.seg3 button { border: 0; background: none; border-radius: 9px; padding: 8px 4px; display: grid; justify-items: center; gap: 2px; color: var(--muted); font-size: 0.8rem; font-weight: 650; min-height: 54px; cursor: pointer; }
.seg3 button[aria-pressed=true] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.seg3 button svg { color: inherit; }
.swatches { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.sw { aspect-ratio: 1; min-height: 44px; border-radius: 50%; border: 3px solid transparent; background: var(--c); display: grid; place-items: center; cursor: pointer; outline-offset: 3px; padding: 0; }
.sw[aria-pressed=true] { border-color: var(--text); }

/* Series: carátulas, búsqueda y sinopsis */
.poster { width: 64px; height: 90px; border-radius: 8px; object-fit: cover; background: var(--surface2); flex: none; }
.poster-ph { display: grid; place-items: center; color: var(--muted); }
.show-main { min-width: 0; display: grid; gap: 2px; }
.show .ep { font-size: 1.05rem; }
.ep-name { font-weight: 650; margin-top: 2px; }
.ep-info details { margin: 2px 0 4px; }
.ep-info summary { cursor: pointer; color: var(--accent); font-size: 0.85rem; padding: 4px 0; }
.ep-info p { margin: 4px 0 0; font-size: 0.88rem; color: var(--muted); }
.results { display: grid; gap: 6px; }
.res { display: grid; grid-template-columns: 40px 1fr; gap: 10px; align-items: center; text-align: left; width: 100%; padding: 8px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; min-height: 60px; }
.res .poster { width: 40px; height: 56px; }
.picked { display: flex; gap: 10px; align-items: center; padding: 8px; border-radius: 12px; background: var(--surface2); }
.picked .poster { width: 36px; height: 50px; }
a { color: var(--accent); }

/* Calendario: ovulación, citas y fases del ciclo */
.day.ovul { background: color-mix(in srgb, var(--ovul) 24%, var(--surface)); border-color: color-mix(in srgb, var(--ovul) 80%, transparent); }
.day.ovul.today { border-color: var(--accent); }
.day .mark.ov { color: var(--ovul); }
.day .star.meet { color: var(--meet); }
.lg-cell.ovul { background: color-mix(in srgb, var(--ovul) 24%, var(--surface)); color: var(--ovul); }
.lg-cell.meet { color: var(--meet); }
.phase { display: flex; gap: 8px; align-items: flex-start; font-size: 0.88rem; margin: 4px 0; }
.pdot { width: 10px; height: 10px; border-radius: 50%; flex: none; margin-top: 5px; background: var(--muted); }
.phase.menstruacion .pdot { background: var(--period); }
.phase.fertil .pdot { background: var(--fertile); }
.phase.ovulacion .pdot { background: var(--ovul); }
.phase.warn .pdot { background: var(--ovul); }
.meet { display: grid; grid-template-columns: 26px 1fr; gap: 6px 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.meet:first-of-type { border-top: 0; }
.meet-ic { color: var(--meet); padding-top: 2px; }
.meet-main { min-width: 0; }
.meet-btns { grid-column: 2; display: flex; gap: 8px; }
.meet-btns .btn.danger { margin-left: 0; }

/* Ajustes por apartados */
.setback { gap: 4px; margin-bottom: 2px; }
.setlist { padding: 4px 8px; display: grid; }
.setrow { display: grid; grid-template-columns: 40px 1fr 18px; gap: 10px; align-items: center; text-align: left; width: 100%; border: 0; background: none; color: var(--text); padding: 12px 6px; border-top: 1px solid var(--line); cursor: pointer; min-height: 60px; }
.setrow:first-child { border-top: 0; }
.setrow:active { background: var(--surface2); border-radius: 12px; }
.seticon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--surface2); color: var(--accent); }
.settext { display: grid; gap: 1px; min-width: 0; }
.setrow > svg { color: var(--muted); }
.colrow { display: grid; gap: 6px; }
.swatches.sm { grid-template-columns: repeat(9, 1fr); gap: 5px; }
.swatches.sm .sw { min-height: 0; border-width: 2px; }
.dlrow { display: grid; grid-template-columns: 1fr 72px 72px; gap: 8px; align-items: center; justify-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.dlrow b { justify-self: start; }
.dlhead { border-top: 0; font-size: 0.75rem; color: var(--muted); text-align: center; padding-bottom: 0; }

.gmark { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #fff; color: #4285f4; font-weight: 800; font-size: 0.85rem; margin-right: 6px; }

/* Chat: audios, una sola vez, escribiendo */
.composer .hidden { display: none !important; }
.micbtn { background: var(--accent); }
.recbar { flex: 1; display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border-radius: 12px; background: var(--surface2); }
.recdot { width: 11px; height: 11px; border-radius: 50%; background: #e11d48; animation: beat 1.2s ease-in-out infinite; }
.audio { display: flex; align-items: center; gap: 10px; min-width: min(240px, 62vw); padding: 2px 0 4px; }
.aplay { width: 38px; height: 38px; border-radius: 50%; border: 0; display: grid; place-items: center; flex: none; cursor: pointer; background: color-mix(in srgb, currentColor 18%, transparent); color: inherit; }
.atrack { flex: 1; height: 5px; border-radius: 5px; background: color-mix(in srgb, currentColor 25%, transparent); overflow: hidden; }
.atrack span { display: block; height: 100%; background: currentColor; transition: width 0.25s linear; }
.adur { font-size: 0.72rem; opacity: 0.85; min-width: 34px; text-align: right; display: inline-flex; gap: 3px; align-items: center; justify-content: flex-end; }
.once { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 12px; margin: 0 0 4px; background: color-mix(in srgb, currentColor 14%, transparent); min-width: min(220px, 60vw); }
.once > div { display: grid; font-size: 0.85rem; }
.once span { opacity: 0.8; font-size: 0.78rem; }
.once.open { cursor: pointer; }
.once.done { opacity: 0.65; }
.dlc { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 2px; color: #fff; background: rgba(0, 0, 0, 0.32); }
.dlc small { font-size: 0.72rem; font-weight: 700; }
.dlb { position: absolute; right: 6px; bottom: 6px; display: inline-flex; gap: 4px; align-items: center; font-size: 0.7rem; font-weight: 700; color: #fff; background: rgba(0, 0, 0, 0.55); padding: 1px 6px; border-radius: 6px; }
.typing { display: flex; align-items: center; gap: 6px; font-size: 0.82rem; color: var(--muted); padding: 2px 6px; min-height: 22px; }
.tdots { display: inline-flex; gap: 3px; }
.tdots i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: tdot 1.1s infinite ease-in-out; }
.tdots i:nth-child(2) { animation-delay: 0.15s; }
.tdots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes tdot { 0%, 80%, 100% { opacity: 0.25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .tdots i, .recdot { animation: none; } }

/* Interruptores: todas las casillas de la app se ven como interruptor, con el texto a la izquierda */
label.check { flex-direction: row-reverse; justify-content: space-between; gap: 14px; }
label.check input[type=checkbox], input[type=checkbox][role=switch] { appearance: none; -webkit-appearance: none; width: 50px; height: 30px; border-radius: 99px; background: var(--surface2); border: 1.5px solid var(--line); position: relative; flex: none; cursor: pointer; transition: background 0.2s; margin: 0; }
label.check input[type=checkbox]::after, input[type=checkbox][role=switch]::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--muted); transition: transform 0.2s, background 0.2s; }
label.check input[type=checkbox]:checked, input[type=checkbox][role=switch]:checked { background: var(--accent); border-color: var(--accent); }
label.check input[type=checkbox]:checked::after, input[type=checkbox][role=switch]:checked::after { transform: translateX(20px); background: var(--accent-ink); }
@media (prefers-reduced-motion: reduce) { label.check input[type=checkbox], label.check input[type=checkbox]::after { transition: none; } }

/* Chat que llega hasta la barra de abajo, enlaces, menú de adjuntar y ocultar la app */
main.chatmain { padding-bottom: 0; }
.chatwrap { height: calc(100dvh - 150px); }
.lnk { color: inherit; text-decoration: underline; text-underline-offset: 2px; word-break: break-all; }
.sheet-switch { padding: 8px 10px 4px; border-top: 1px solid var(--line); margin-top: 4px; }
.disg { display: grid; grid-template-columns: 48px 1fr 22px; gap: 12px; align-items: center; width: 100%; text-align: left; border: 1.5px solid var(--line); background: var(--surface); color: var(--text); padding: 10px; border-radius: 14px; cursor: pointer; min-height: 64px; }
.disg[aria-pressed=true] { border-color: var(--accent); }
.dico { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; color: #fff; }

/* Selector de hora propio */
.fieldbox { display: grid; gap: 4px; font-size: 0.88rem; color: var(--muted); }
.timebtn { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--text); cursor: pointer; font-size: 1.1rem; text-align: left; }
.timebtn svg { color: var(--accent); }
.timesheet { gap: 12px; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); }
.tp-title { font-weight: 700; font-size: 1.05rem; text-align: center; }
.tp-cols { display: flex; justify-content: center; align-items: center; gap: 10px; }
.tp-col { height: 220px; width: 92px; overflow-y: auto; display: grid; gap: 4px; align-content: start; padding: 4px; border-radius: 16px; background: var(--bg); border: 1px solid var(--line); scroll-snap-type: y mandatory; overscroll-behavior: contain; }
.tp-item { border: 0; background: none; color: var(--text); font-size: 1.25rem; padding: 10px 0; border-radius: 12px; cursor: pointer; scroll-snap-align: center; font-variant-numeric: tabular-nums; }
.tp-item.on { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.tp-sep { font-size: 1.6rem; font-weight: 700; color: var(--muted); }
.tp-col { scrollbar-width: none; }
.tp-col::-webkit-scrollbar { display: none; }

/* Archivos vencidos, HD y zona de peligro */
.media.gone { cursor: default; }
.media.gone img { filter: grayscale(1) blur(3px); opacity: 0.45; }
.audio.gone { display: flex; align-items: center; gap: 8px; opacity: 0.7; min-width: 150px; }
.sheet-switch.sub { border-top: 0; margin-top: 0; padding-top: 0; }
.btn.dangerfull { background: transparent; color: var(--period); border: 1.5px solid color-mix(in srgb, var(--period) 55%, transparent); margin-left: 0; }
.card.danger { border: 1px solid color-mix(in srgb, var(--period) 40%, transparent); }

/* Lista de widgets en Ajustes */
.wrow { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.wrow:first-child { border-top: 0; }
.wrow .settext { flex: 1; min-width: 0; display: grid; gap: 2px; }

/* Visor: contador, flechas y zoom */
.vbody { touch-action: none; overflow: hidden; width: 100vw; height: 100dvh; align-content: center; }
.vbody img { will-change: transform; transform-origin: center; user-select: none; -webkit-user-drag: none; }
.vcount { position: absolute; top: calc(18px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); color: #fff; background: rgba(255, 255, 255, 0.16); padding: 3px 12px; border-radius: 999px; font-size: 0.85rem; z-index: 2; }
.vnav { position: absolute; top: 50%; transform: translateY(-50%); width: 40px; height: 56px; border: 0; border-radius: 14px; background: rgba(255, 255, 255, 0.14); color: #fff; display: grid; place-items: center; cursor: pointer; z-index: 2; }
.vnav.prev { left: 6px; }
.vnav.next { right: 6px; }
.day .seenmk { position: absolute; bottom: 3px; right: 4px; color: var(--accent); line-height: 0; }
.lg-cell.seen { color: var(--accent); }

/* Animaciones cortas de transición */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes enterR { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }
@keyframes enterL { from { opacity: 0; transform: translateX(-18px); } to { opacity: 1; transform: none; } }
@keyframes sheetUp { from { opacity: 0; transform: translateY(28px); } to { opacity: 1; transform: none; } }
@keyframes msgIn { from { opacity: 0; transform: translateY(10px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes vInR { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: none; } }
@keyframes vInL { from { opacity: 0; transform: translateX(-40px); } to { opacity: 1; transform: none; } }
main.enter-r { animation: enterR 0.22s ease-out; }
main.enter-l { animation: enterL 0.22s ease-out; }
main.chatmain.enter-r, main.chatmain.enter-l { animation: fadeIn 0.18s ease-out; }
.sheet-back { animation: fadeIn 0.16s ease-out; }
.sheet { animation: sheetUp 0.24s cubic-bezier(0.2, 0.8, 0.2, 1); }
.viewer.vfirst { animation: fadeIn 0.2s ease-out; }
.viewer.vdir-next .vbody > * { animation: vInR 0.22s ease-out; }
.viewer.vdir-prev .vbody > * { animation: vInL 0.22s ease-out; }
.msg.msg-new { animation: msgIn 0.22s ease-out; }
.btn, .tab, .setrow, .day, .iconbtn { transition: transform 0.12s ease, background-color 0.15s ease, opacity 0.15s ease; }
.btn:active, .setrow:active, .day:active, .iconbtn:active { transform: scale(0.97); }
.tab:active { transform: scale(0.92); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* Reacciones con emojis */
.reacts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; justify-content: flex-start; }
.msg.mine .reacts { justify-content: flex-end; }
.rx { display: inline-flex; align-items: center; gap: 3px; border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 999px; padding: 1px 8px; font-size: 0.95rem; line-height: 1.5; cursor: pointer; }
.rx small { font-size: 0.7rem; color: var(--muted); }
.rx.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, var(--surface)); }
.rxrow { display: flex; justify-content: space-between; gap: 2px; padding: 4px 4px 8px; }
.rxgrid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; padding: 0 4px 8px; }
.rxgrid.hidden { display: none; }
.rxpick { border: 0; background: none; font-size: 1.55rem; line-height: 1; min-width: 44px; min-height: 44px; border-radius: 12px; display: grid; place-items: center; cursor: pointer; color: var(--text); transition: transform 0.12s ease, background-color 0.15s ease; }
.rxpick:active { transform: scale(1.18); }
.rxpick.on { background: color-mix(in srgb, var(--accent) 22%, var(--surface)); }
.rxpick.more { background: var(--surface2); }

/* Barra de descarga de la actualización */
.updbar { height: 10px; border-radius: 999px; background: var(--surface2); overflow: hidden; }
.updbar > span { display: block; height: 100%; background: var(--accent); transition: width 0.2s; }
