/* SERENA / Editorial (referencia: 03_SERENA_EDITORIAL.html). Capa final sobre los componentes:
   crema plana, verde salvia, serif para titulos y cifras, tarjetas de 20 px, barra anclada abajo con
   el registro en el centro. Solo forma y tipografia: ninguna regla cambia que se muestra. */

:root {
  /* Barra anclada al borde inferior: lo que flota encima se mide desde el area segura. */
  --tabbar-gap: var(--safe-bottom);
}

/* ---- Fondo: crema plana, sin halos ---- */
html,
body {
  background: var(--bg);
}

body::before,
body::after {
  display: none;
}

/* ---- Tipografia editorial ---- */
.today-title,
.page-title,
.page-head .page-title,
.sheet-title,
.section-title,
h1,
h2 {
  font-family: var(--font-serif);
  font-weight: 400;
  letter-spacing: -0.045em;
}

.today-title,
.page-title {
  font-size: 38px;
  line-height: 1.04;
}

.sheet-title {
  font-size: 29px;
  line-height: 1.08;
}

/* Cifras grandes: serif, sin negrita (la jerarquia la da el tamano). */
.stat-val,
.data-num,
.metric-val,
.ring-core b,
.week-hero b,
.wk-hero b,
.water-total-ml,
.water-qty-input {
  font-family: var(--font-serif);
  font-weight: 400;
  letter-spacing: -0.05em;
}

.kicker,
.eyebrow,
.page-head .eyebrow {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #718879;
}

/* ---- Marca ---- */
.brand {
  font-family: var(--font-serif);
  font-weight: 600;
  letter-spacing: -0.05em;
}

.brand-tile {
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: none;
}

/* ---- Tarjetas: planas, borde fino, radio editorial ---- */
.card,
.stat,
.metric,
.hero-aura,
.week-hero,
.wk-hero,
.night,
.session,
.goal-row,
.hub-row,
.rows {
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  box-shadow: none;
}

.hero-aura,
.week-hero,
.wk-hero {
  background: var(--panel-3);
  border-color: #d8e0d2;
  border-radius: var(--r-xl);
}

/* ---- Botones ---- */
.btn {
  border-radius: 100px;
}

.btn-accent {
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: none;
}

.btn-accent:active {
  background: var(--accent-2);
}

.link-btn {
  display: block;
  margin: 12px auto 0;
  padding: 8px 12px;
  background: none;
  border: 0;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---- Barra inferior anclada, con el registro en el centro ---- */
.tabbar {
  left: 0;
  right: 0;
  bottom: 0;
  transform: none;
  width: 100%;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  grid-template-columns: repeat(2, 1fr) 64px repeat(3, 1fr);
  align-items: center;
  gap: 4px;
  padding: 6px 12px calc(6px + var(--safe-bottom));
  border-radius: 0;
  border: 0;
  border-top: 1px solid var(--border);
  background: rgba(248, 247, 239, 0.96);
  box-shadow: none;
}

@media (min-width: 560px) {
  .tabbar {
    left: 50%;
    transform: translateX(-50%);
    width: 520px;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
  }
}

.tab-ind {
  display: none;
}

.tab {
  height: 52px;
  border-radius: 100px;
  font-size: 10px;
  font-weight: 700;
}

.tab[aria-current="page"] {
  color: var(--accent);
  background: #e7eadb;
}

.tab[aria-current="page"] .tab-ico {
  transform: none;
}

.fab.tab-new {
  position: relative;
  inset: auto;
  justify-self: center;
  width: 53px;
  height: 53px;
  margin-top: -18px;
  border-radius: 50%;
  color: var(--on-accent);
  background: var(--accent);
  box-shadow: 0 6px 16px rgba(53, 105, 89, 0.22);
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.fab.tab-new:active {
  transform: scale(0.94);
  background: var(--accent-2);
}

:root:has(.sheet.open) .fab.tab-new {
  opacity: 1;
  transform: none;
}

/* ---- Hojas ---- */
.sheet {
  background: #fbfaf4;
  border-top: 1px solid #c9d7ca;
  border-radius: 30px 30px 0 0;
}

.sheet-backdrop {
  background: rgba(38, 54, 45, 0.32);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

/* ---- Registrar: cinco categorias en una fila; Pasos y Nota debajo ---- */
.reg-grid {
  grid-template-columns: repeat(10, 1fr);
  gap: 7px;
  margin-top: 20px;
}

.reg {
  grid-column: span 2;
  flex-direction: column;
  justify-content: center;
  gap: 7px;
  min-height: 82px;
  padding: 11px 3px;
  border-radius: 16px;
  background: var(--panel);
  border-color: var(--border);
  font-size: 11px;
  font-weight: 750;
  text-align: center;
}

.reg .reg-text {
  display: grid;
  gap: 2px;
}

.reg .reg-sub {
  font-size: 10px;
  color: var(--muted);
}

.reg.reg-wide {
  grid-column: span 5;
  flex-direction: row;
  justify-content: flex-start;
  min-height: 54px;
  padding: 0 14px;
  font-size: 13px;
  text-align: left;
}

.reg:active {
  background: var(--accent-soft);
  border-color: var(--accent);
}

/* ---- Agua: vasos ---- */
.water-qty {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 22px 0 6px;
}

.water-step {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--panel-3);
  border: 1px solid var(--border);
  color: var(--text);
}

.water-step:active {
  background: var(--accent-soft);
}

.water-qty-num {
  display: grid;
  justify-items: center;
}

.water-qty-num small {
  font-size: 12px;
  color: var(--muted);
}

.water-qty-input {
  width: 120px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 60px;
  line-height: 1.05;
  text-align: center;
  -moz-appearance: textfield;
  appearance: textfield;
}

.water-qty-input::-webkit-inner-spin-button,
.water-qty-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.water-presets {
  display: flex;
  gap: 7px;
  margin: 14px 0 4px;
}

.water-preset {
  flex: 1;
  min-height: 44px;
  border-radius: 13px;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
}

.water-preset.on {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.water-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 18px 0;
  padding: 14px 16px;
  border-radius: 15px;
  background: #ebf1e9;
  font-size: 13px;
  color: var(--muted);
}

.water-total-ml {
  font-size: 24px;
  color: var(--text);
}

.water-save {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 54px;
  font-size: 15px;
  font-weight: 800;
}

@media (prefers-reduced-motion: reduce) {
  .fab.tab-new,
  .tab {
    transition: none;
  }
}

/* ---- Heroes planos (como .serena-hero del prototipo) ---- */
.hero,
.hero-aura,
.night {
  background: var(--panel-3);
  border: 1px solid #d8e0d2;
  border-radius: var(--r-xl);
  box-shadow: none;
}

.night {
  background: var(--panel);
  border-color: var(--hairline);
}

/* Cifras grandes en serif, como en el prototipo. */
.big {
  font-family: var(--font-serif);
  font-weight: 400;
  letter-spacing: -0.06em;
}

.big small {
  font-family: var(--font);
}

/* La esfera brillante pasa a ser la «flor» de anillos suaves del prototipo, en el tono del sueno. */
.moon-orb {
  background: radial-gradient(
    circle at 55% 45%,
    #8c97b3 0 18%,
    #dfe3ec 19% 33%,
    #a7b0c6 34% 48%,
    #eceef3 49% 64%,
    #bcc3d4 65% 78%,
    transparent 79%
  );
  box-shadow: none;
}

/* ---- Fotos en los registros ----
   Miniaturas cuadradas de radio editorial; cada una lleva una etiqueta con su estado real
   (sin guardar / en este iPhone / subida / perdida). Los botones de anadir son de la misma talla. */
.photo-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.photo-label small {
  font-size: 11px;
  font-weight: 650;
  color: var(--faint);
  letter-spacing: 0.01em;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.photo-thumb {
  position: relative;
  margin: 0;
  aspect-ratio: 1;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--panel-3);
  padding: 0;
  color: inherit;
  font: inherit;
}

.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-badge {
  position: absolute;
  left: 6px;
  bottom: 6px;
  max-width: calc(100% - 12px);
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 750;
  line-height: 1.2;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: rgba(251, 248, 241, 0.9);
  color: var(--text);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.photo-badge--uploaded {
  background: var(--accent);
  color: var(--on-accent);
}

.photo-badge--lost {
  background: #f3e1d9;
  color: #8a3b22;
}

.photo-missing {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 4px;
  padding: 6px 6px 26px;
  text-align: center;
  font-size: 10.5px;
  font-weight: 650;
  color: var(--faint);
  background: repeating-linear-gradient(
    -45deg,
    var(--panel-3) 0 8px,
    var(--panel) 8px 16px
  );
}

.photo-missing .ico {
  width: 20px;
  height: 20px;
  opacity: 0.7;
}

.photo-missing--lost {
  color: #8a3b22;
}

.photo-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(38, 54, 45, 0.74);
  color: #fff;
}

/* Area tactil de 44 px sin agrandar el circulo. */
.photo-remove::after {
  content: "";
  position: absolute;
  inset: -8px;
}

.photo-remove .ico {
  width: 14px;
  height: 14px;
}

.photo-add {
  position: relative;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  border-radius: 16px;
  border: 1.5px dashed var(--border-strong);
  background: var(--panel);
  color: var(--accent);
  font-size: 11px;
  font-weight: 750;
  text-align: center;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.photo-add .ico {
  width: 22px;
  height: 22px;
}

.photo-add--camera {
  border-style: solid;
  border-color: transparent;
  background: var(--accent-soft);
}

.photo-add:active {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.photo-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.photo-add:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.photo-status {
  margin: 8px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}

/* Detalle de un registro */
.photo-section {
  margin: 18px 0 6px;
}

.photo-section-title {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #718879;
}

.photo-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}

.photo-strip .photo-thumb {
  flex: none;
  width: 112px;
  scroll-snap-align: start;
  cursor: zoom-in;
}

.photo-viewer img,
.photo-viewer .photo-missing {
  width: 100%;
  max-height: 68vh;
  object-fit: contain;
  border-radius: 20px;
  background: var(--panel-3);
}

.photo-viewer .photo-missing {
  aspect-ratio: 4 / 3;
}

.photo-viewer-note {
  margin: 14px 2px 0;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--muted);
}

.photo-viewer-note--lost {
  color: #8a3b22;
}

/* ---- SERENA · pulido final: fuera los restos de AURA ----
   Sin halos, resplandores, cristal ni degradados decorativos. Superficies planas, serif ligera para
   titulos y cifras (numeros de caja alta), sans para etiquetas. Solo forma: no cambia que se ve. */
.hero-aura::before,
.hero-aura::after,
.stat::before,
.metric::before {
  display: none;
}

.hero-aura,
.week-hero,
.wk-hero {
  background: var(--panel-2);
  border-color: var(--border);
  box-shadow: none;
}

.hero-title,
.hero-day .hero-title {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 46px;
  letter-spacing: -0.045em;
}

.sec-title {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 23px;
  letter-spacing: -0.035em;
}

.ring-arc {
  filter: none;
}

.ring-core strong {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 40px;
  letter-spacing: -0.05em;
  text-shadow: none;
}

.ring-core span {
  letter-spacing: 0.14em;
  font-weight: 750;
  color: var(--faint);
}

/* Registro rapido: tarjetas planas; el agua, en salvia suave y no con resplandor. */
.dock .act {
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: none;
}

.dock .act-primary {
  background: var(--accent-soft);
  border-color: transparent;
}

/* Mas: cifras serif de caja alta, etiquetas sans; sin halo. */
.data-hero {
  background: var(--panel);
  box-shadow: none;
  border-color: var(--border);
}

.data-num,
.stat-val,
.metric-val {
  font-variant-numeric: lining-nums tabular-nums;
}

.data-hero .data-num + span,
.data-hero span {
  font-family: var(--font);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.01em;
  color: var(--muted);
}

/* Lista de Mas: una sola tarjeta con separadores, no tarjetas dentro de una tarjeta. */
.hub {
  padding: 0;
  overflow: hidden;
}

.hub .hub-row {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.hub .hub-row + .hub-row {
  border-top: 1px solid var(--border);
}

/* Sueno: la luna es un disco sereno, sin brillo. */
.moon-orb {
  background: var(--panel-3);
  border: 1px solid var(--border);
  box-shadow: none;
}

/* Avisos: tinta salvia sobre crema, sin cristal. */
.toast {
  background: var(--text);
  color: var(--bg);
  border-color: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  box-shadow: 0 10px 30px rgba(38, 54, 45, 0.18);
}

.toast .toast-undo {
  background: rgba(251, 250, 243, 0.14);
  color: var(--bg);
}

.week-hero .week-hero-title,
.week-hero.is-compact .week-hero-title {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 26px;
  letter-spacing: -0.035em;
}
