/* ============ Maya — diseño ============ */
:root {
  --bg: #fff5f8;
  --card: #ffffff;
  --text: #2b2330;
  --text-2: #8a7f90;
  --pink: #f06a9b;
  --pink-soft: #ffe3ee;
  --pink-deep: #d94f84;
  --lav: #e9e2ff;
  --mint: #dff5ea;
  --peach: #ffeadd;
  --blue-soft: #e3f0ff;
  --yellow-soft: #fff6d9;
  --danger: #e25555;
  --radius: 22px;
  --shadow: 0 6px 24px rgba(214, 110, 152, .12);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --borde: #f0dde7;
  --seg: #f3e7ed;
  --barra: rgba(255,255,255,.9);
  --header-bg: rgba(255,245,248,.86);
  --linea: #f7ebf1;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

.hidden { display: none !important; }

/* ============ Login ============ */
.login-screen {
  min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: linear-gradient(160deg, #ffe9f2 0%, #fff5f8 45%, #f3edff 100%);
}
.login-card {
  width: 100%; max-width: 360px;
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(20px);
  border-radius: 28px;
  padding: 36px 28px;
  box-shadow: var(--shadow);
  text-align: center;
}
.login-icon { font-size: 56px; margin-bottom: 8px; }
.login-card h1 { font-size: 34px; font-weight: 800; letter-spacing: -.5px; }
.login-sub { color: var(--text-2); margin: 6px 0 24px; }
.login-card input {
  width: 100%; padding: 15px 18px; margin-bottom: 12px;
  border: 1.5px solid var(--borde); border-radius: 16px;
  font-size: 17px; background: var(--card); color: var(--text);
  outline: none; transition: border-color .2s;
}
.login-card input:focus { border-color: var(--pink); }
.login-error { color: var(--danger); margin-top: 14px; font-size: 15px; animation: shake .35s; }
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-7px)} 75%{transform:translateX(7px)} }

/* ============ Estructura ============ */
.app { min-height: 100dvh; display: flex; flex-direction: column; }

.app-header {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(14px + var(--safe-top)) 20px 10px;
  background: var(--header-bg);
  backdrop-filter: blur(18px);
}
.app-header h1 { font-size: 28px; font-weight: 800; letter-spacing: -.5px; }
.header-sub { font-size: 13px; color: var(--text-2); margin-top: 1px; }
.header-right { display: flex; align-items: center; gap: 12px; }
.icon-btn { background: none; border: none; font-size: 22px; cursor: pointer; padding: 4px; }

.sync-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: #cfc6d4; display: inline-block;
}
.sync-dot.ok { background: #4cc38a; }
.sync-dot.busy { background: #f5b54a; animation: pulse 1s infinite; }
.sync-dot.error { background: var(--danger); }
@keyframes pulse { 50% { opacity: .35; } }

.main {
  flex: 1;
  padding: 8px 16px calc(96px + var(--safe-bottom));
  max-width: 560px; width: 100%; margin: 0 auto;
}

/* ============ Tab bar ============ */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  display: flex; justify-content: space-around;
  padding: 8px 8px calc(8px + var(--safe-bottom));
  background: var(--barra);
  backdrop-filter: blur(18px);
  border-top: 1px solid rgba(214,110,152,.12);
}
.tab {
  flex: 1; max-width: 110px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: none; border: none; cursor: pointer;
  font-size: 11px; font-weight: 600; color: var(--text-2);
  padding: 6px 0; border-radius: 14px; transition: color .15s;
}
.tab-icon { font-size: 22px; filter: grayscale(.7) opacity(.7); transition: filter .15s, transform .15s; }
.tab.active { color: var(--pink-deep); }
.tab.active .tab-icon { filter: none; transform: scale(1.12); }

/* ============ Componentes ============ */
.card {
  background: var(--card); border-radius: var(--radius);
  padding: 18px; margin-bottom: 14px; box-shadow: var(--shadow);
}
.card h2 { font-size: 18px; font-weight: 700; margin-bottom: 12px; }
.card-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

.section-title {
  font-size: 22px; font-weight: 800; letter-spacing: -.4px;
  margin: 14px 4px 12px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--pink) 0%, var(--pink-deep) 100%);
  color: #fff; border: none; border-radius: 16px;
  padding: 15px 22px; font-size: 17px; font-weight: 700;
  cursor: pointer; transition: transform .1s, opacity .15s;
}
.btn-primary:active { transform: scale(.97); }
.btn-secondary {
  background: var(--pink-soft); color: var(--pink-deep);
  border: none; border-radius: 16px;
  padding: 13px 20px; font-size: 16px; font-weight: 700; cursor: pointer;
}
.btn-secondary:active { transform: scale(.97); }
.btn-ghost {
  background: none; border: none; color: var(--pink-deep);
  font-size: 15px; font-weight: 600; cursor: pointer; padding: 8px;
}
.btn-danger { background: #ffe5e5; color: var(--danger); border: none; border-radius: 16px; padding: 13px 20px; font-size: 16px; font-weight: 700; cursor: pointer; }
.btn-block { width: 100%; display: block; }

/* resumen del día (inicio) */
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.stat-card {
  border-radius: var(--radius); padding: 16px;
  display: flex; flex-direction: column; gap: 4px;
  box-shadow: var(--shadow);
}
.stat-card .stat-emoji { font-size: 24px; }
.stat-card .stat-value { font-size: 22px; font-weight: 800; letter-spacing: -.4px; }
.stat-card .stat-label { font-size: 13px; color: var(--text-2); font-weight: 600; }
.stat-card .stat-ago { font-size: 12px; color: var(--text-2); }
.bg-peach { background: var(--peach); }
.bg-lav { background: var(--lav); }
.bg-mint { background: var(--mint); }
.bg-blue { background: var(--blue-soft); }
.bg-pink { background: var(--pink-soft); }
.bg-yellow { background: var(--yellow-soft); }

.quick-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.quick-btn {
  border: none; border-radius: 18px; padding: 14px 6px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 700; color: var(--text);
  cursor: pointer; box-shadow: var(--shadow); background: var(--card);
}
.quick-btn span:first-child { font-size: 26px; }
.quick-btn:active { transform: scale(.96); }

/* segmento */
.segmented {
  display: flex; background: var(--seg); border-radius: 14px; padding: 4px; margin-bottom: 16px;
}
.segmented button {
  flex: 1; border: none; background: none; padding: 10px 4px;
  font-size: 14px; font-weight: 700; color: var(--text-2);
  border-radius: 11px; cursor: pointer; transition: all .15s;
}
.segmented button.active { background: var(--card); color: var(--text); box-shadow: 0 2px 8px rgba(0,0,0,.08); }

/* botones de pecho */
.boob-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.boob-btn {
  border: none; border-radius: 24px; padding: 26px 10px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  cursor: pointer; box-shadow: var(--shadow);
  font-size: 16px; font-weight: 800; color: var(--text);
}
.boob-btn .big { font-size: 36px; }
.boob-btn .hint { font-size: 12px; font-weight: 600; color: var(--text-2); }
.boob-btn:active { transform: scale(.96); }
.boob-izq { background: linear-gradient(150deg, #ffe3ee, #ffd1e3); }
.boob-der { background: linear-gradient(150deg, #e9e2ff, #dcd1ff); }

/* timer activo */
.active-timers { max-width: 560px; width: 100%; margin: 0 auto; padding: 0 16px; }
.timer-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: linear-gradient(135deg, #ffd9e8, #ffc4da);
  border-radius: 18px; padding: 12px 16px; margin: 8px 0;
  box-shadow: var(--shadow);
}
.timer-banner.sleep { background: linear-gradient(135deg, #ddd3ff, #cfc2ff); }
.timer-banner .timer-info { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; }
.timer-banner .timer-clock { font-variant-numeric: tabular-nums; font-size: 22px; font-weight: 800; }
.timer-banner button {
  border: none; border-radius: 12px; padding: 9px 14px;
  font-weight: 800; font-size: 14px; cursor: pointer; background: var(--card); color: var(--pink-deep);
}
.timer-banner button.stop { background: var(--pink-deep); color: #fff; }

/* listas de registros */
.entry-list { display: flex; flex-direction: column; gap: 8px; }
.day-label { font-size: 13px; font-weight: 800; color: var(--text-2); text-transform: uppercase; letter-spacing: .5px; margin: 14px 4px 4px; }
.entry {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border-radius: 16px; padding: 12px 14px;
  box-shadow: 0 2px 10px rgba(214,110,152,.08);
}
.entry .entry-emoji { font-size: 24px; }
.entry .entry-main { flex: 1; min-width: 0; }
.entry .entry-title { font-weight: 700; font-size: 15px; }
.entry .entry-sub { font-size: 13px; color: var(--text-2); margin-top: 1px; }
.entry .entry-time { font-size: 13px; font-weight: 700; color: var(--text-2); white-space: nowrap; }
.entry .entry-actions { display: flex; gap: 2px; }
.entry .entry-actions button { background: none; border: none; font-size: 16px; cursor: pointer; padding: 6px; opacity: .55; }

.empty-state { text-align: center; color: var(--text-2); padding: 36px 20px; font-size: 15px; }
.empty-state .big { font-size: 44px; display: block; margin-bottom: 10px; }

/* pañal: botones gigantes */
.diaper-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.diaper-btn {
  border: none; border-radius: 22px; padding: 22px 6px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-size: 14px; font-weight: 800; cursor: pointer; box-shadow: var(--shadow);
}
.diaper-btn span:first-child { font-size: 34px; }
.diaper-btn:active { transform: scale(.95); }

/* formularios en hoja */
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(43,35,48,.4); z-index: 40;
  animation: fadein .2s;
}
@keyframes fadein { from { opacity: 0 } }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41;
  background: var(--bg); border-radius: 26px 26px 0 0;
  padding: 10px 20px calc(24px + var(--safe-bottom));
  max-height: 88dvh; overflow-y: auto;
  max-width: 560px; margin: 0 auto;
  animation: slideup .25s cubic-bezier(.2,.9,.3,1);
}
@keyframes slideup { from { transform: translateY(100%) } }
.sheet-handle { width: 40px; height: 5px; border-radius: 3px; background: #e0d3da; margin: 4px auto 14px; }
.sheet h2 { font-size: 21px; font-weight: 800; margin-bottom: 16px; }

.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; font-weight: 700; color: var(--text-2); margin-bottom: 6px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 13px 15px; font-size: 16px;
  border: 1.5px solid var(--borde); border-radius: 14px; background: var(--card); color: var(--text);
  outline: none; font-family: inherit;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--pink); }
.form-row { display: flex; gap: 10px; }
.form-row .form-group { flex: 1; }

/* stepper de ml */
.ml-stepper { display: flex; align-items: center; justify-content: center; gap: 18px; margin: 10px 0 16px; }
.ml-stepper button {
  width: 52px; height: 52px; border-radius: 50%; border: none;
  background: var(--pink-soft); color: var(--pink-deep);
  font-size: 26px; font-weight: 800; cursor: pointer;
}
.ml-stepper .ml-value { font-size: 40px; font-weight: 800; min-width: 120px; text-align: center; letter-spacing: -1px; }
.ml-stepper .ml-value small { font-size: 17px; color: var(--text-2); font-weight: 700; }
.ml-presets { display: flex; gap: 8px; justify-content: center; margin-bottom: 16px; flex-wrap: wrap; }
.ml-presets button {
  border: none; background: var(--card); box-shadow: var(--shadow);
  border-radius: 12px; padding: 9px 16px; font-weight: 700; font-size: 14px; cursor: pointer; color: var(--text);
}

/* condiciones */
.condition-card { border-left: 5px solid var(--pink); }
.measure-row { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--linea); font-size: 15px; }
.measure-row:last-child { border-bottom: none; }
.measure-val { font-weight: 800; }
.measure-pending { color: #c08a2e; font-weight: 700; }
.info-box {
  background: var(--blue-soft); border-radius: 16px; padding: 14px; margin-top: 12px;
  font-size: 14px; line-height: 1.5;
}
.info-box h4 { font-size: 14px; margin-bottom: 6px; }
.info-box a { color: #2563ad; font-weight: 600; }
.info-box ul { padding-left: 18px; margin: 6px 0; }
.care-box { background: var(--mint); border-radius: 16px; padding: 14px; margin-top: 10px; font-size: 14px; line-height: 1.5; }
.care-box h4 { font-size: 14px; margin-bottom: 6px; }
.care-box ul { padding-left: 18px; }
.disclaimer { font-size: 12px; color: var(--text-2); margin-top: 10px; font-style: italic; }

/* fotos */
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.photo-grid img {
  width: 100%; aspect-ratio: 1; object-fit: cover;
  border-radius: 14px; cursor: pointer; background: var(--pink-soft);
}
.photo-viewer {
  position: fixed; inset: 0; z-index: 60; background: rgba(20,15,22,.92);
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px;
}
.photo-viewer img { max-width: 100%; max-height: 75dvh; border-radius: 14px; }
.photo-viewer .pv-caption { color: #fff; margin-top: 12px; font-size: 14px; text-align: center; }
.photo-viewer .pv-actions { margin-top: 14px; display: flex; gap: 12px; }

/* menú "Más" */
.menu-list { display: flex; flex-direction: column; gap: 10px; }
.menu-item {
  display: flex; align-items: center; gap: 14px;
  background: var(--card); border: none; border-radius: 18px; padding: 16px;
  box-shadow: var(--shadow); cursor: pointer; text-align: left;
  font-size: 16px; font-weight: 700; color: var(--text); width: 100%;
}
.menu-item .mi-emoji { font-size: 26px; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; border-radius: 13px; }
.menu-item .mi-sub { display: block; font-size: 12.5px; color: var(--text-2); font-weight: 500; margin-top: 1px; }
.menu-item .mi-chev { margin-left: auto; color: #d4c6cd; font-size: 18px; }

.back-row { display: flex; align-items: center; gap: 4px; margin: 6px 0 2px; }
.back-row button { background: none; border: none; color: var(--pink-deep); font-size: 16px; font-weight: 700; cursor: pointer; padding: 8px 4px; }

.toast {
  position: fixed; bottom: calc(100px + var(--safe-bottom)); left: 50%; transform: translateX(-50%);
  background: var(--text); color: #fff; padding: 12px 22px;
  border-radius: 100px; font-size: 15px; font-weight: 600; z-index: 70;
  box-shadow: 0 8px 24px rgba(0,0,0,.25); white-space: nowrap;
  animation: toastin .25s;
}
@keyframes toastin { from { opacity: 0; transform: translate(-50%, 12px) } }

.checkbox-row { display: flex; align-items: center; gap: 10px; padding: 10px 2px; font-size: 16px; font-weight: 600; }
.checkbox-row input { width: 22px; height: 22px; accent-color: var(--pink-deep); }

canvas.chart { width: 100% !important; }

@media (min-width: 600px) {
  .app-header, .active-timers { max-width: 560px; margin: 0 auto; }
}

/* ============ avatar y pull-to-refresh ============ */
.header-left { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.header-avatar {
  width: 42px; height: 42px; border-radius: 50%; object-fit: cover;
  border: 2.5px solid #fff; box-shadow: 0 2px 10px rgba(214,110,152,.3);
}
.header-avatar.girando { animation: girar 1s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }

.ptr {
  position: fixed; top: calc(8px + var(--safe-top)); left: 50%;
  transform: translate(-50%, -60px); z-index: 50;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--card); box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; transition: transform .2s;
}
.ptr.visible { transform: translate(-50%, 10px); }
.ptr.girando .ptr-spinner { display: inline-block; animation: latir .7s infinite; }
@keyframes latir { 50% { transform: scale(1.35); } }

/* 6 pestañas: etiquetas un poco más compactas */
.tab { font-size: 10px; }

/* ============ retos / actividades ============ */
.retos-hero {
  border-radius: 26px; padding: 20px;
  background: linear-gradient(135deg, #ff9ec3 0%, #c79df5 100%);
  color: #fff; box-shadow: 0 10px 30px rgba(199,157,245,.4);
  display: flex; align-items: center; gap: 18px; margin-bottom: 16px;
  animation: hero-in .5s cubic-bezier(.2,.9,.3,1);
}
@keyframes hero-in { from { opacity: 0; transform: translateY(14px) scale(.97); } }
.retos-hero h2 { font-size: 19px; font-weight: 800; margin-bottom: 2px; }
.retos-hero .hero-sub { font-size: 13px; opacity: .9; }
.racha-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(255,255,255,.22); border-radius: 100px;
  padding: 5px 12px; font-size: 13px; font-weight: 800; margin-top: 8px;
}
.racha-chip .flama { display: inline-block; animation: flamear 1s infinite alternate; }
@keyframes flamear { from { transform: scale(1) rotate(-4deg); } to { transform: scale(1.18) rotate(4deg); } }

.anillo { position: relative; width: 86px; height: 86px; flex-shrink: 0; }
.anillo svg { transform: rotate(-90deg); }
.anillo circle { fill: none; stroke-width: 8; stroke-linecap: round; }
.anillo .fondo { stroke: rgba(255,255,255,.25); }
.anillo .avance { stroke: #fff; transition: stroke-dashoffset .8s cubic-bezier(.2,.9,.3,1); }
.anillo .num {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  font-size: 19px; font-weight: 800; line-height: 1;
}
.anillo .num small { font-size: 10px; font-weight: 700; opacity: .85; }

.tarea {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border-radius: 20px; padding: 14px;
  box-shadow: var(--shadow); margin-bottom: 10px;
  opacity: 0; animation: tarea-in .45s cubic-bezier(.2,.9,.3,1) forwards;
}
.tarea:nth-child(1) { animation-delay: .03s } .tarea:nth-child(2) { animation-delay: .09s }
.tarea:nth-child(3) { animation-delay: .15s } .tarea:nth-child(4) { animation-delay: .21s }
.tarea:nth-child(5) { animation-delay: .27s } .tarea:nth-child(6) { animation-delay: .33s }
.tarea:nth-child(7) { animation-delay: .39s } .tarea:nth-child(8) { animation-delay: .45s }
@keyframes tarea-in { from { opacity: 0; transform: translateX(-16px); } to { opacity: 1; } }

.tarea .t-emoji {
  width: 48px; height: 48px; border-radius: 15px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 26px;
  background: var(--pink-soft);
}
.tarea.especial .t-emoji { background: linear-gradient(135deg, #ffe9a8, #ffd166); }
.tarea .t-main { flex: 1; min-width: 0; }
.tarea .t-titulo { font-weight: 800; font-size: 15px; }
.tarea .t-desc { font-size: 12.5px; color: var(--text-2); margin-top: 2px; line-height: 1.35; }
.tarea .t-cond { display: inline-block; font-size: 10.5px; font-weight: 800; color: #b06a00;
  background: #fff1d6; border-radius: 100px; padding: 2px 8px; margin-bottom: 3px; }

.t-check {
  width: 46px; height: 46px; border-radius: 50%; border: 2.5px dashed #e8c9d8;
  background: none; font-size: 22px; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: all .2s; color: transparent;
}
.t-check.lista {
  border: none; background: linear-gradient(135deg, #4cc38a, #2ea06d);
  color: #fff; animation: pop-check .45s cubic-bezier(.3,1.6,.4,1);
  box-shadow: 0 4px 14px rgba(76,195,138,.45);
}
@keyframes pop-check { 0% { transform: scale(.3) rotate(-30deg); } 70% { transform: scale(1.2) rotate(6deg); } 100% { transform: scale(1); } }
.t-play {
  width: 46px; height: 46px; border-radius: 50%; border: none; flex-shrink: 0;
  background: linear-gradient(135deg, var(--pink), var(--pink-deep)); color: #fff;
  font-size: 17px; font-weight: 800; cursor: pointer;
  box-shadow: 0 4px 14px rgba(240,106,155,.4);
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1;
}
.t-play small { font-size: 8.5px; font-weight: 800; }
.t-play:active, .t-check:active { transform: scale(.92); }
.tarea.hecha { opacity: .75 !important; }
.tarea.hecha .t-titulo { text-decoration: line-through; text-decoration-color: #4cc38a; }

/* timer de actividad en curso */
.timer-banner.actividad { background: linear-gradient(135deg, #c9f3de, #a8e8c8); }
.timer-banner.actividad .timer-clock { color: #1d7a4f; }

/* medallas */
.medallero { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.medalla {
  background: var(--card); border-radius: 18px; padding: 12px 6px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  box-shadow: var(--shadow); text-align: center; position: relative; overflow: hidden;
}
.medalla .m-emoji { font-size: 28px; filter: grayscale(1) opacity(.35); }
.medalla .m-nombre { font-size: 10px; font-weight: 800; color: var(--text-2); }
.medalla.ganada .m-emoji { filter: none; animation: medalla-pop .5s cubic-bezier(.3,1.6,.4,1); }
.medalla.ganada .m-nombre { color: var(--text); }
.medalla.ganada::after {
  content: ''; position: absolute; top: -60%; left: -70%; width: 50%; height: 220%;
  background: linear-gradient(105deg, transparent, rgba(255,255,255,.9), transparent);
  transform: rotate(20deg); animation: brillo 2.8s infinite;
}
@keyframes medalla-pop { 0% { transform: scale(.4); } 70% { transform: scale(1.25); } 100% { transform: scale(1); } }
@keyframes brillo { 0% { left: -70%; } 45% { left: 130%; } 100% { left: 130%; } }

/* confeti */
.confeti {
  position: fixed; top: -12px; z-index: 80; pointer-events: none;
  width: 10px; height: 10px; border-radius: 2px;
  animation: confeti-cae linear forwards;
}
@keyframes confeti-cae {
  to { transform: translateY(105vh) rotate(720deg); opacity: .9; }
}

/* celebración de día completo */
.celebracion {
  position: fixed; inset: 0; z-index: 75; pointer-events: none;
  display: flex; align-items: center; justify-content: center;
}
.celebracion .cele-card {
  background: var(--card); border-radius: 26px; padding: 28px 34px; text-align: center;
  box-shadow: 0 18px 60px rgba(0,0,0,.25);
  animation: cele-in .55s cubic-bezier(.3,1.5,.4,1), cele-out .4s ease 2.6s forwards;
}
.celebracion .cele-emoji { font-size: 54px; display: block; animation: flamear .8s infinite alternate; }
.celebracion .cele-texto { font-size: 19px; font-weight: 800; margin-top: 8px; }
.celebracion .cele-sub { font-size: 13px; color: var(--text-2); margin-top: 2px; }
@keyframes cele-in { 0% { transform: scale(.3); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes cele-out { to { transform: scale(.8); opacity: 0; } }

/* tarjeta de foto semanal */
.foto-semanal {
  border-radius: 22px; padding: 16px; margin-bottom: 14px;
  background: linear-gradient(135deg, #fff6e3, #ffe9c7);
  box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 12px;
  animation: hero-in .5s cubic-bezier(.2,.9,.3,1);
}
.foto-semanal .fs-emoji { font-size: 34px; animation: flamear 1.2s infinite alternate; }
.foto-semanal .fs-titulo { font-weight: 800; font-size: 15px; }
.foto-semanal .fs-sub { font-size: 12.5px; color: #9a7430; margin-top: 1px; }
.foto-semanal button {
  margin-left: auto; border: none; border-radius: 14px; padding: 11px 16px;
  background: #2b2330; color: #fff; font-weight: 800; font-size: 13px; cursor: pointer;
  flex-shrink: 0;
}

/* ============ vigilia y colores de popó ============ */
.timer-banner.vigilia { background: linear-gradient(135deg, #ffe9b8, #ffd98c); }
.timer-banner.vigilia .timer-clock { color: #9a6b00; }

.sueno-botones { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 8px; }
.sueno-botones button {
  border: none; border-radius: 22px; padding: 22px 8px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-size: 15px; font-weight: 800; cursor: pointer; box-shadow: var(--shadow);
  color: var(--text);
}
.sueno-botones button span:first-child { font-size: 32px; }
.sueno-botones button:active { transform: scale(.96); }
.sueno-botones .hint { font-size: 11.5px; font-weight: 600; color: var(--text-2); }

.color-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 8px 0 4px; }
.color-opt {
  border: 2.5px solid transparent; border-radius: 16px; padding: 10px 6px;
  background: var(--card); cursor: pointer; box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; color: var(--text);
}
.color-opt .bolita { width: 30px; height: 30px; border-radius: 50%; border: 2px solid rgba(0,0,0,.08); }
.color-opt.activo { border-color: var(--pink-deep); }
.color-opt:active { transform: scale(.95); }

.color-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid rgba(0,0,0,.12); vertical-align: -1px; }

/* ============ bitácora de vigilia ============ */
.quien-chips { display: flex; gap: 8px; margin: 6px 0 12px; }
.quien-chips button {
  flex: 1; border: none; border-radius: 100px; padding: 10px 6px;
  font-weight: 700; font-size: 13.5px; cursor: pointer;
  background: #f3e7ed; color: var(--text-2); transition: all .15s;
}
.quien-chips button.activo {
  background: linear-gradient(135deg, #ffd98c, #ffc964); color: #7a5200;
  transform: scale(1.04);
}
.bitacora { margin: 6px 0 10px; }
.bitacora-item {
  display: flex; align-items: baseline; gap: 8px;
  padding: 7px 0; border-bottom: 1px solid var(--linea); font-size: 14px;
}
.bitacora-item:last-child { border-bottom: none; }
.bitacora-item b { color: #9a6b00; font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 12.5px; }
.bitacora-item span { flex: 1; }
.bitacora-item .bit-x { background: none; border: none; cursor: pointer; opacity: .45; font-size: 14px; }
.vig-add { display: flex; gap: 8px; }
.vig-add input {
  flex: 1; padding: 12px 14px; border: 1.5px solid var(--borde);
  border-radius: 14px; font-size: 15px; outline: none; background: var(--card); color: var(--text);
}
.vig-add input:focus { border-color: var(--pink); }
.vig-add button {
  border: none; border-radius: 14px; padding: 0 18px;
  background: var(--pink-deep); color: #fff; font-size: 20px; font-weight: 800; cursor: pointer;
}
.entry-bitacora {
  font-size: 12.5px; color: var(--text-2); margin-top: 5px;
  border-left: 2.5px solid #ffd98c; padding-left: 8px; line-height: 1.5;
}
.entry-bitacora b { color: #9a6b00; font-variant-numeric: tabular-nums; }

/* etiqueta de quién escribió cada nota */
.bit-autor {
  display: inline-block; font-size: 10px; font-weight: 800;
  background: var(--pink-soft); color: var(--pink-deep);
  border-radius: 100px; padding: 1.5px 7px; margin-left: 5px;
  vertical-align: 1px; white-space: nowrap;
}
.dispositivo-botones { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.dispositivo-botones button {
  border: none; border-radius: 20px; padding: 22px 10px;
  font-size: 16px; font-weight: 800; cursor: pointer; box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--text);
}
.dispositivo-botones button span:first-child { font-size: 34px; }
.dispositivo-botones button:active { transform: scale(.95); }

/* ============ foto y análisis de popó ============ */
.color-opt.sugerido { border-color: #f5b54a; background: #fff8e8; animation: pop-check .4s; }
.pp-analizando { text-align: center; padding: 14px; color: var(--text-2); font-weight: 700; animation: pulse 1s infinite; }
.pp-resultado {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--blue-soft); border-radius: 16px; padding: 12px; margin-top: 10px;
  font-size: 13.5px; line-height: 1.45; animation: hero-in .4s;
}
.pp-resultado img { width: 64px; height: 64px; object-fit: cover; border-radius: 12px; flex-shrink: 0; }
.pp-resultado small { color: var(--text-2); }
.entry-thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 10px; cursor: pointer; background: var(--pink-soft); }

/* ============ banco de leche ============ */
.banco-card {
  display: flex; align-items: center; gap: 16px;
  background: var(--card); border-radius: 22px; padding: 14px 16px;
  box-shadow: var(--shadow); margin-bottom: 14px; cursor: pointer;
}
.banco-card:active { transform: scale(.985); }
.banco-info { flex: 1; min-width: 0; }
.banco-info .b-titulo { font-weight: 800; font-size: 15px; }
.banco-info .b-ml { font-size: 24px; font-weight: 800; letter-spacing: -.5px; margin: 1px 0; }
.banco-info .b-sub { font-size: 12.5px; color: var(--text-2); }
.nivel-chip {
  display: inline-block; font-size: 11px; font-weight: 800; color: #fff;
  border-radius: 100px; padding: 3px 10px; margin-top: 5px;
}

.tanque {
  position: relative; width: 56px; height: 82px; flex-shrink: 0;
  border-radius: 14px 14px 18px 18px;
  background: linear-gradient(180deg, #faf4f8, #f3eaf0);
  border: 3px solid #e8d9e1; overflow: hidden;
}
.tanque::before { /* cuello del tanque */
  content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 22px; height: 5px; border-radius: 0 0 6px 6px; background: #e8d9e1;
}
.tanque .nivel {
  position: absolute; left: 0; right: 0; bottom: 0;
  transition: height .9s cubic-bezier(.2,.9,.3,1), background-color .4s;
}
.tanque .nivel .ola {
  position: absolute; top: -6px; left: -20%; width: 140%; height: 12px;
  background: inherit; opacity: .65; border-radius: 45%;
  animation: olita 3s linear infinite;
}
@keyframes olita { from { transform: rotate(0) } to { transform: rotate(360deg) } }
.tanque.grande { width: 92px; height: 132px; border-radius: 18px 18px 24px 24px; }

.banco-saldos { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px 0; }
.banco-saldo {
  border-radius: 18px; padding: 14px; text-align: center; box-shadow: var(--shadow);
}
.banco-saldo .bs-ml { font-size: 24px; font-weight: 800; letter-spacing: -.5px; }
.banco-saldo .bs-label { font-size: 12px; color: var(--text-2); font-weight: 700; }
.banco-acciones { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 8px; }
.banco-acciones button {
  border: none; border-radius: 16px; padding: 14px 8px;
  font-size: 13.5px; font-weight: 800; cursor: pointer; box-shadow: var(--shadow);
  background: var(--card); color: var(--text);
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.banco-acciones button span { font-size: 19px; }
.banco-acciones button:active { transform: scale(.96); }

/* ============ timer de extracción y producción ============ */
.timer-banner.extraccion { background: linear-gradient(135deg, #c8ecf5, #a5dded); }
.timer-banner.extraccion .timer-clock { color: #0e6b8c; }
.fase-chip {
  display: inline-block; background: rgba(255,255,255,.55); border-radius: 100px;
  padding: 2px 10px; font-size: 11.5px; font-weight: 800; color: #0e6b8c;
}
.prod-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0; }
.prod-stat { background: var(--card); border-radius: 14px; padding: 10px 4px; text-align: center; box-shadow: 0 2px 10px rgba(214,110,152,.08); }
.prod-stat .ps-num { font-size: 16px; font-weight: 800; letter-spacing: -.3px; }
.prod-stat .ps-label { font-size: 10px; color: var(--text-2); font-weight: 700; }
.prod-stat.record { background: linear-gradient(135deg, #fff6d9, #ffedb3); }
.tips-card { background: var(--blue-soft); border-radius: 20px; padding: 16px; margin-bottom: 14px; }
.tips-card h3 { font-size: 15px; font-weight: 800; margin-bottom: 4px; }
.tips-card .tc-resumen { font-size: 12px; color: #4a6b85; font-weight: 600; margin-bottom: 10px; }
.tip-item { display: flex; gap: 10px; padding: 8px 0; border-top: 1px solid var(--linea); font-size: 13.5px; line-height: 1.45; }
.tip-item .t-emoji { font-size: 20px; flex-shrink: 0; }

/* ============ selector de bebés ============ */
.bebes-bar {
  max-width: 560px; width: 100%; margin: 0 auto; padding: 6px 16px 0;
  display: flex; gap: 8px; overflow-x: auto;
}
.bebe-chip {
  border: none; border-radius: 100px; padding: 8px 16px;
  background: var(--card); box-shadow: var(--shadow); cursor: pointer;
  font-size: 13.5px; font-weight: 800; color: var(--text-2);
  white-space: nowrap; display: flex; align-items: center; gap: 6px;
  transition: all .15s;
}
.bebe-chip.activo {
  background: linear-gradient(135deg, var(--pink), var(--pink-deep));
  color: #fff; transform: scale(1.04);
}
.bebe-chip.agregar { color: var(--pink-deep); border: 1.5px dashed #e8c9d8; background: none; box-shadow: none; }

/* ============ análisis general ============ */
.analisis-estado {
  border-radius: 22px; padding: 18px; margin-bottom: 14px; color: #fff;
  display: flex; align-items: center; gap: 14px; box-shadow: var(--shadow);
  animation: hero-in .5s cubic-bezier(.2,.9,.3,1);
}
.analisis-estado .ae-emoji { font-size: 40px; }
.analisis-estado .ae-titulo { font-size: 18px; font-weight: 800; }
.analisis-estado .ae-sub { font-size: 13px; opacity: .92; margin-top: 2px; }
.hallazgo {
  display: flex; gap: 12px; background: var(--card); border-radius: 18px;
  padding: 14px; margin-bottom: 10px; box-shadow: var(--shadow);
  font-size: 14px; line-height: 1.45;
}
.hallazgo .h-emoji { font-size: 22px; flex-shrink: 0; }
.hallazgo b { display: block; font-size: 14.5px; }
.hallazgo .h-dato { color: var(--text-2); font-size: 12.5px; margin-top: 3px; }
.hallazgo.nivel-bien { border-left: 4px solid #4cc38a; }
.hallazgo.nivel-observar { border-left: 4px solid #f5b54a; }
.hallazgo.nivel-atencion { border-left: 4px solid #e25555; }
.analisis-mini {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border-radius: 20px; padding: 13px 16px;
  box-shadow: var(--shadow); margin-bottom: 14px; cursor: pointer;
}
.analisis-mini .am-emoji { font-size: 26px; }
.analisis-mini .am-texto { flex: 1; font-size: 13.5px; font-weight: 700; }
.analisis-mini .am-sub { display: block; font-size: 12px; color: var(--text-2); font-weight: 600; }

/* ============ temas de color ============ */
:root[data-tema="noche"] {
  --bg: #191420;
  --card: #262030;
  --text: #f3ecf4;
  --text-2: #a595a8;
  --pink: #f06a9b;
  --pink-soft: #45283a;
  --pink-deep: #e05c8f;
  --lav: #332a4d;
  --mint: #1f3a2d;
  --peach: #3e2d24;
  --blue-soft: #22303f;
  --yellow-soft: #3a3220;
  --borde: #453a4e;
  --seg: #322a3d;
  --barra: rgba(30,24,38,.92);
  --header-bg: rgba(25,20,32,.88);
  --linea: #382f42;
  --shadow: 0 6px 24px rgba(0,0,0,.35);
}
:root[data-tema="menta"] {
  --bg: #f1faf5;
  --pink: #2eb381;
  --pink-soft: #d5f3e5;
  --pink-deep: #1d9468;
  --peach: #e8f6e3;
  --lav: #e2f0ec;
  --yellow-soft: #f4f7d9;
  --borde: #d8ece1;
  --seg: #e2f0e9;
  --barra: rgba(255,255,255,.92);
  --header-bg: rgba(241,250,245,.88);
  --linea: #e6f2eb;
  --shadow: 0 6px 24px rgba(46,179,129,.13);
}
:root[data-tema="lavanda"] {
  --bg: #f5f2ff;
  --pink: #8b6ef0;
  --pink-soft: #e7e0ff;
  --pink-deep: #6f4fe0;
  --peach: #efe9ff;
  --mint: #e4f0ee;
  --borde: #e2daf5;
  --seg: #e9e3f8;
  --barra: rgba(255,255,255,.92);
  --header-bg: rgba(245,242,255,.88);
  --linea: #ece6fa;
  --shadow: 0 6px 24px rgba(139,110,240,.14);
}
:root[data-tema="noche"] .login-screen { background: linear-gradient(160deg, #241b2e 0%, #191420 55%, #1f1830 100%); }
:root[data-tema="noche"] .login-card { background: rgba(38,32,48,.9); }
:root[data-tema="noche"] .login-card input { background: var(--card); color: var(--text); }
:root[data-tema="noche"] .segmented button.active { box-shadow: none; background: #453a52; color: var(--text); }
:root[data-tema="noche"] .boob-izq { background: linear-gradient(150deg, #4a2f3f, #55354a); }
:root[data-tema="noche"] .boob-der { background: linear-gradient(150deg, #362c50, #40345e); }
:root[data-tema="noche"] .diaper-btn, :root[data-tema="noche"] .quick-btn { color: var(--text); }
:root[data-tema="noche"] .tanque { background: linear-gradient(180deg, #2c2536, #241e2e); border-color: #453a4e; }

/* selector de tema */
.temas-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tema-opcion {
  border: 2.5px solid transparent; border-radius: 20px; padding: 16px 10px;
  cursor: pointer; text-align: center; font-weight: 800; font-size: 14px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  box-shadow: var(--shadow);
}
.tema-opcion.activo { border-color: var(--pink-deep); }
.tema-opcion .bolitas { display: flex; gap: 5px; }
.tema-opcion .bolitas span { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid rgba(0,0,0,.08); }

/* guía de etapa en el análisis */
.hallazgo.nivel-info { border-left: 4px solid #8b6ef0; }
.h-lista { padding-left: 18px; margin: 6px 0 2px; color: var(--text-2); font-size: 13px; }
.h-lista li { margin-bottom: 3px; }

/* ============ ventana de sueño y rutina de dormir ============ */
.ventana-card { border-left: 5px solid #9b87e8; }
.ventana-barra {
  height: 14px; border-radius: 100px; background: var(--seg);
  overflow: hidden; margin: 10px 0 6px;
}
.ventana-barra .vb-fill {
  height: 100%; border-radius: 100px;
  transition: width .8s cubic-bezier(.2,.9,.3,1), background-color .4s;
}
.ventana-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-2); font-weight: 600; }

.rutina-paso {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border-radius: 16px; padding: 12px 14px;
  box-shadow: var(--shadow); margin-bottom: 8px;
}
.rutina-paso .rp-emoji { font-size: 24px; }
.rutina-paso .rp-titulo { flex: 1; font-weight: 700; font-size: 14.5px; }
.rutina-paso .rp-min { font-size: 12px; color: var(--text-2); font-weight: 700; white-space: nowrap; }
.rutina-paso.hecho { opacity: .6; }
.rutina-paso.hecho .rp-titulo { text-decoration: line-through; text-decoration-color: #4cc38a; }
.rutina-check {
  width: 40px; height: 40px; border-radius: 50%; border: 2.5px dashed var(--borde);
  background: none; font-size: 19px; cursor: pointer; flex-shrink: 0;
  color: transparent; display: flex; align-items: center; justify-content: center;
}
.rutina-check.lista {
  border: none; background: linear-gradient(135deg, #9b87e8, #7c63d8);
  color: #fff; animation: pop-check .4s cubic-bezier(.3,1.6,.4,1);
}
.rutina-progreso {
  height: 10px; border-radius: 100px; background: var(--seg); overflow: hidden; margin: 8px 0 12px;
}
.rutina-progreso div {
  height: 100%; background: linear-gradient(90deg, #9b87e8, #7c63d8);
  border-radius: 100px; transition: width .5s cubic-bezier(.2,.9,.3,1);
}
.timer-banner.rutina { background: linear-gradient(135deg, #ddd3ff, #c9bcf5); }

/* ============ bienestar de mamá ============ */
.epds-op {
  display: block; width: 100%; text-align: left;
  background: var(--card); border: 2px solid var(--borde); border-radius: 16px;
  padding: 14px 16px; margin-bottom: 9px; cursor: pointer;
  font-size: 14.5px; font-weight: 600; color: var(--text);
  transition: all .15s;
}
.epds-op:active { transform: scale(.98); border-color: var(--pink); }
.epds-recurso {
  display: block; background: var(--card); border-radius: 14px;
  padding: 13px 15px; margin-bottom: 8px; box-shadow: var(--shadow);
  font-size: 14px; font-weight: 700; color: var(--text); text-decoration: none;
}
