/* ============================================================
   NUEVE LUNAS — tokens
   Base neutro: papel verdoso muy suave + tinta ciruela + salvia/oro
   Niño: azules empolvados · Niña: rosas apagados
   Display: serif editorial (system) · Body: sans del sistema
   Datos/números: monoespaciada — la app "mide" el tiempo
   ============================================================ */

:root{
  --bg: #F5F6F0;
  --bg-raise: #FFFFFF;
  --ink: #2B2430;
  --ink-soft: #6B6470;
  --line: rgba(43,36,48,0.09);

  --accent: #7C9473;      /* salvia */
  --accent-soft: #E3E9DC;
  --accent2: #D9A441;     /* oro cálido */

  --radius-lg: 26px;
  --radius-md: 18px;
  --radius-sm: 12px;

  --font-display: ui-serif, Georgia, "Iowan Old Style", "Palatino Linotype", serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Roboto Mono", Menlo, monospace;

  --shadow-soft: 0 8px 24px rgba(43,36,48,0.08);
  --shadow-lift: 0 14px 34px rgba(43,36,48,0.14);
}

html[data-theme="nino"]{
  --bg: #EEF3F7;
  --bg-raise: #FFFFFF;
  --ink: #24303B;
  --ink-soft: #63727E;
  --line: rgba(36,48,59,0.10);
  --accent: #6E93BE;
  --accent-soft: #DCE7F1;
  --accent2: #4F7396;
}

html[data-theme="nina"]{
  --bg: #F8EEF0;
  --bg-raise: #FFFFFF;
  --ink: #3A2430;
  --ink-soft: #7A6670;
  --line: rgba(58,36,48,0.10);
  --accent: #C97C93;
  --accent-soft: #F3DEE4;
  --accent2: #B4587A;
}

body, .topbar, .icon-btn, .stat-card, .sex-btn, .event-row, .bottom-nav,
.cal-day, .field-input, .doc-item, .modal-sheet, .upload-drop, .doc-tab,
.empty-hint, .chip, .ghost-btn {
  transition: background-color .35s ease, border-color .35s ease, color .35s ease, box-shadow .35s ease;
}

*{ box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body{ height: 100%; }
body{
  margin:0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea{ font-family: inherit; }
input, textarea{ color: var(--ink); }

#app{ padding-bottom: 92px; min-height:100vh; }

/* ---------- topbar ---------- */
.topbar{
  display:flex; align-items:center; justify-content:space-between;
  padding: 22px 20px 6px;
}
.topbar-brand{ display:flex; align-items:center; gap:8px; }
.brand-mark{ font-size: 21px; color: var(--accent2); }
.brand-name{ font-family: var(--font-display); font-size: 21px; font-weight: 700; letter-spacing: .2px; color: var(--ink); }
.icon-btn{
  background: var(--bg-raise); border: none; border-radius: 50%;
  width: 40px; height:40px; display:flex; align-items:center; justify-content:center;
  color: var(--ink); box-shadow: var(--shadow-soft); cursor:pointer;
}

/* ---------- views ---------- */
.view{ padding: 6px 20px 10px; }
.hidden{ display:none !important; }
.section-title{
  font-size: 13px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--ink-soft); margin: 0 0 10px;
}
.muted{ color: var(--ink-soft); }
.muted.small{ font-size: 13px; }

/* ---------- clock hero ---------- */
.clock-hero{ display:flex; flex-direction: column; align-items:center; padding: 12px 0 6px; }
.clock-wrap{ position: relative; width: 284px; height: 284px; max-width: 88vw; }
.clock-ring{ width:100%; height:100%; transform: rotate(-90deg); }
.ring-track{ fill:none; stroke: var(--accent-soft); stroke-width: 14; }

.clock-subcaption{
  font-size: 12px; color: var(--ink-soft); text-align:center;
  margin: 10px 0 0; letter-spacing:.01em;
  transition: opacity .22s ease;
}
.clock-subcaption.swapping{ opacity: 0; }

/* ---------- selector de unidad ---------- */
.unit-switch{
  position: relative; display:flex; margin-top: 18px;
  background: var(--accent-soft); border-radius: 999px; padding: 4px;
  width: 100%; max-width: 300px;
}
.unit-pill{
  position:absolute; top:4px; bottom:4px; left:4px;
  width: calc((100% - 8px) / 3); border-radius: 999px;
  background: var(--bg-raise); box-shadow: var(--shadow-soft);
  transition: transform .42s cubic-bezier(.34,1.32,.5,1);
  will-change: transform;
}
.unit-btn{
  position: relative; z-index:1; flex:1; background:none; border:none;
  padding: 9px 4px; font-size: 13px; font-weight:600; color: var(--ink-soft);
  cursor:pointer; transition: color .28s ease; border-radius: 999px;
}
.unit-btn.active{ color: var(--ink); }

/* transición del centro y de las marcas al cambiar de unidad */
.clock-center{ transition: opacity .22s ease; }
.clock-center.swapping{ opacity: 0; }
#month-ticks{ transition: opacity .28s ease; }
#month-ticks.swapping{ opacity: 0; }
.ring-fill{
  fill:none; stroke: var(--accent); stroke-width: 14; stroke-linecap: butt;
  stroke-dasharray: 804.2; stroke-dashoffset: 804.2;
  transition: stroke-dashoffset 1.1s cubic-bezier(.4,0,.2,1), stroke 0.5s ease;
}
.ring-fill-tip{ fill: var(--accent); transition: cx 1.1s cubic-bezier(.4,0,.2,1), cy 1.1s cubic-bezier(.4,0,.2,1), fill .5s ease; }
.ring-marker{ fill: var(--bg-raise); stroke: var(--accent2); stroke-width: 4; transition: cx 1.1s cubic-bezier(.4,0,.2,1), cy 1.1s cubic-bezier(.4,0,.2,1); }
#month-ticks line{ stroke: var(--bg); stroke-width: 3; opacity:.9; }
#month-ticks text{ fill: var(--ink-soft); font-family: var(--font-mono); font-size: 11px; font-weight: 600; }
#month-ticks .baby-goal{ color: var(--accent2); }

.clock-center{
  position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center;
  text-align:center;
}
.clock-eyebrow{ font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-soft); }
.clock-week{ font-family: var(--font-mono); font-size: 52px; font-weight: 600; line-height:1; margin-top:4px; color: var(--ink); }
.clock-week-unit{ font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }
.clock-days{ font-family: var(--font-mono); font-size: 12.5px; color: var(--accent2); margin-top: 5px; font-weight:600; }

.belly-stage{ position: relative; height: 190px; display:flex; align-items:flex-end; justify-content:center; margin-top: -6px; }
.belly-glow{
  position:absolute; bottom: 8px; width: 150px; height: 60px; border-radius: 50%;
  background: radial-gradient(closest-side, var(--accent-soft), transparent 70%);
  filter: blur(2px); z-index:0;
}
#belly-img{ position:relative; z-index:1; height: 185px; width:auto; object-fit: contain; transition: opacity .5s ease; }

.stat-row{ display:flex; gap:10px; width:100%; margin-top: 18px; }
.stat-card{
  flex:1; background: var(--bg-raise); border-radius: var(--radius-md); padding: 16px 14px;
  display:flex; flex-direction:column; align-items:center; text-align:center; gap:4px;
  box-shadow: var(--shadow-soft);
}
.stat-card.wide{ width:100%; }
.stat-value{ font-family: var(--font-mono); font-weight:700; font-size: 21px; line-height:1.2; }
.stat-label{
  font-size: 11px; color: var(--ink-soft); line-height:1.3;
  text-transform: uppercase; letter-spacing: .07em;
}

/* ---------- sex picker ---------- */
.sex-options{ display:flex; gap:10px; margin-top: 6px; }
.sex-btn{
  flex:1; display:flex; align-items:center; justify-content:center; gap:8px;
  background: var(--bg-raise); border: 1.5px solid var(--line); border-radius: var(--radius-md);
  padding: 12px 8px; font-size: 13.5px; font-weight:600; color: var(--ink-soft); cursor:pointer;
  transition: all .2s ease;
}
.sex-btn.selected{ border-color: var(--accent); color: var(--ink); background: var(--accent-soft); }
.sex-dot{ width:10px; height:10px; border-radius:50%; display:inline-block; }
/* El punto de "Aún no" conserva SIEMPRE su dorado original, aunque el
   tema de la app cambie a niño o niña: representa "todavía sin definir". */
.dot-neutro{ background: #D9A441; }
.dot-nino{ background: #6E93BE; }
.dot-nina{ background: #C97C93; }

/* ---------- foto rápida (home) ---------- */
.quick-photo{ margin-top: 22px; }
.quick-photo-btn{
  width:100%; display:flex; align-items:center; justify-content:center; gap:9px;
  background: var(--ink); color:#fff; border:none; border-radius: var(--radius-md);
  padding: 14px; font-size: 14.5px; font-weight:700; cursor:pointer;
}

/* ---------- filas de subida (subir + cámara) ---------- */
.upload-row{ display:flex; gap:10px; margin-bottom: 16px; }
.upload-row .upload-drop{ flex:1; margin-bottom:0; }
.upload-row .upload-drop.small{ margin-bottom:0; }

/* ---------- insignia de foto en eventos/calendario ---------- */
.event-badge.has-photo{ background: transparent; width:auto; height:auto; }
.camera-tag{
  display:inline-flex; align-items:center; justify-content:center;
  width:18px; height:18px; border-radius:50%; background: var(--accent-soft); color: var(--accent2);
  flex-shrink:0;
}
.cal-day .dot.photo-dot{ background: var(--accent2); width:5px; height:5px; }
.upcoming{ margin-top: 26px; }
.upcoming-head{ display:flex; align-items:center; justify-content:space-between; }
.link-btn{ background:none; border:none; color: var(--accent2); font-weight:600; font-size:13px; margin-bottom:10px; }
.upcoming-list{ display:flex; flex-direction:column; gap:8px; }
.empty-hint{ color: var(--ink-soft); font-size: 13.5px; padding: 18px; background: var(--bg-raise); border-radius: var(--radius-md); text-align:center; }
.event-row{
  background: var(--bg-raise); border-radius: var(--radius-md); padding: 12px 14px;
  display:flex; align-items:center; gap:12px; box-shadow: var(--shadow-soft);
}
.event-badge{ width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex-shrink:0; }
.event-info{ flex:1; min-width:0; }
.event-title{ font-weight:600; font-size:14.5px; }
.event-meta{ font-size:12px; color: var(--ink-soft); }
.event-type-tag{
  font-size: 10.5px; padding: 3px 8px; border-radius: 20px; background: var(--accent-soft); color: var(--ink);
  font-weight:600; white-space:nowrap;
}

/* ---------- línea de tiempo: estantería horizontal ---------- */
.tl-head h2{ font-family: var(--font-display); font-size: 20px; margin: 12px 0 2px; }
.tl-switch{ max-width: 100%; margin-top: 14px; }
.tl-switch .unit-pill{ width: calc((100% - 8px) / 4); }
.tl-switch .unit-btn{ font-size: 12.5px; }

.tl-shelf{
  position: relative; width:100%; height: 370px; margin-top: 14px;
  border-radius: var(--radius-lg); overflow: hidden;
  background: linear-gradient(to bottom, var(--bg-raise) 0%, var(--bg-raise) 72%, var(--accent-soft) 100%);
  box-shadow: var(--shadow-soft);
  display:flex; align-items:center; justify-content:center;
  perspective: 1100px; perspective-origin: 50% 46%;
  touch-action: pan-y; cursor: grab;
  -webkit-user-select:none; user-select:none;
}
.tl-shelf.dragging{ cursor: grabbing; }
.tl-reel{ position:absolute; inset:0; transform-style: preserve-3d; }

/* la tabla del estante */
.tl-plank{
  position:absolute; left:0; right:0; bottom: 44px; height: 3px;
  background: var(--ink); opacity:.14; border-radius: 3px;
  box-shadow: 0 6px 14px rgba(43,36,48,.10);
}

/* cada "libro" */
.tl-item{
  position:absolute; left:50%; top:50%;
  width: 190px; height: 268px; margin-left: -95px; margin-top: -152px;
  border-radius: 8px; overflow:hidden;
  background: var(--bg);
  box-shadow: 0 10px 26px rgba(43,36,48,.22);
  display:flex; align-items:center; justify-content:center;
  transform-style: preserve-3d; backface-visibility: hidden;
  will-change: transform, opacity;
  border-left: 3px solid rgba(43,36,48,.10);
}
.tl-item img{ width:100%; height:100%; object-fit: cover; pointer-events:none; }
.tl-item-doc{
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:9px; padding: 0 16px; color: var(--accent2); text-align:center;
}
.tl-item-doc .n{ font-size: 12.5px; font-weight:600; color: var(--ink); word-break: break-word; }
.tl-item-doc .h{ font-size: 10.5px; color: var(--ink-soft); }

.tl-item-badge{
  position:absolute; left:0; right:0; bottom:0;
  background: linear-gradient(to top, rgba(43,36,48,.80), rgba(43,36,48,0));
  color:#fff; font-family: var(--font-mono); font-size: 11px; font-weight:700;
  padding: 16px 8px 7px; text-align:center; pointer-events:none;
  letter-spacing: .01em;
}

.tl-empty{
  position:relative; z-index:5; color: var(--ink-soft); font-size: 13.5px;
  text-align:center; padding: 0 34px;
}

.tl-caption{ display:flex; flex-direction:column; align-items:center; margin-top: 14px; text-align:center; }
.tl-caption-main{ font-family: var(--font-mono); font-weight:700; font-size: 16px; }
.tl-caption-sub{ font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }

/* regla temporal: los ítems se reparten según su fecha real */
.tl-timebar{ position: relative; height: 46px; margin: 16px 2px 0; }
.tl-timebar-line{
  position:absolute; top: 15px; left: 4px; right: 4px; height: 2px;
  background: var(--accent-soft); border-radius: 2px;
}
.tl-timebar-dots{ position:absolute; top:0; left: 4px; right: 4px; height: 32px; }
.tl-timebar-dot{
  position:absolute; top: 10px; width: 9px; height: 9px; margin-left: -4.5px;
  border-radius: 50%; background: var(--ink-soft); opacity: .38;
  border: none; padding: 0; cursor: pointer;
  transition: transform .22s ease, background .22s ease, opacity .22s ease;
}
.tl-timebar-dot.active{ background: var(--accent2); opacity: 1; transform: scale(1.65); }
.tl-timebar-cursor{
  position:absolute; top: 6px; width: 2px; height: 20px; margin-left: -1px;
  background: var(--accent2); border-radius: 2px; opacity:.55;
  transition: left .18s cubic-bezier(.4,0,.2,1);
}
.tl-timebar-labels{
  position:absolute; bottom: 0; left: 4px; right: 4px;
  display:flex; justify-content: space-between;
  font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-soft);
}

.tl-controls{
  display:flex; align-items:center; justify-content:space-between;
  margin-top: 16px; padding-bottom: 24px; gap: 10px;
}
.tl-play{
  display:inline-flex; align-items:center; gap:8px;
  background: var(--ink); color:#fff; border:none; border-radius: 999px;
  padding: 11px 18px; font-size: 13.5px; font-weight:700; cursor:pointer;
  transition: opacity .2s ease;
}
.tl-play:disabled{ opacity:.35; }
.tl-counter{ font-family: var(--font-mono); font-size: 12.5px; color: var(--ink-soft); }

/* perilla giratoria */
.tl-knob-box{ display:flex; flex-direction:column; align-items:center; gap:3px; }
.tl-knob{
  width: 62px; height: 62px; border-radius: 50%;
  background: var(--bg-raise);
  box-shadow: 0 4px 12px rgba(43,36,48,.18), inset 0 0 0 1.5px var(--line);
  display:flex; align-items:center; justify-content:center;
  touch-action: none; cursor: grab; position: relative;
}
.tl-knob:active{ cursor: grabbing; }
.tl-knob-face{
  width: 100%; height: 100%; border-radius: 50%; position: relative;
  background:
    repeating-conic-gradient(from 0deg,
      var(--accent-soft) 0deg 5deg,
      transparent 5deg 15deg);
  -webkit-mask: radial-gradient(circle, transparent 0 62%, #000 63% 100%);
  mask: radial-gradient(circle, transparent 0 62%, #000 63% 100%);
}
.tl-knob-mark{
  position:absolute; top: 5px; left: 50%; margin-left: -2px;
  width: 4px; height: 11px; border-radius: 3px; background: var(--accent2);
}
.tl-knob-hint{ font-size: 10px; color: var(--ink-soft); letter-spacing:.06em; text-transform: uppercase; }

.cal-head{ display:flex; align-items:center; justify-content:space-between; padding: 14px 4px 6px; }
.cal-head h2{ font-family: var(--font-display); font-size: 19px; margin:0; }
.cal-weekdays{ display:grid; grid-template-columns: repeat(7,1fr); text-align:center; font-size:11.5px; color: var(--ink-soft); margin: 6px 0 4px; font-weight:600; }
.cal-grid{ display:grid; grid-template-columns: repeat(7,1fr); gap: 4px; }
.cal-day{
  aspect-ratio: 1; display:flex; flex-direction:column; align-items:center; justify-content:center;
  border-radius: 14px; font-size: 13.5px; position: relative; cursor:pointer; color: var(--ink);
  background: transparent;
}
.cal-day.out-range{ color: rgba(107,100,112,0.3); }
.cal-day.in-pregnancy{ background: var(--accent-soft); }
.cal-day.is-today{ box-shadow: inset 0 0 0 2px var(--accent2); font-weight:700; }
.cal-day.selected{ background: var(--accent); color: #fff; }
.cal-day .dot{ width:4px; height:4px; border-radius:50%; background: var(--accent2); position:absolute; bottom:6px; }
.cal-day.selected .dot{ background: #fff; }

.day-panel{ margin-top: 18px; }
.day-panel-head{ display:flex; align-items:center; justify-content:space-between; margin-bottom: 10px; }
.day-panel-head h3{ font-family: var(--font-display); font-size: 16px; margin:0; }
.fab-mini{ background: var(--ink); color:#fff; border:none; border-radius: 20px; padding: 8px 14px; font-size:13px; font-weight:600; }
.day-events-list{ display:flex; flex-direction:column; gap:8px; padding-bottom: 20px; }

/* ---------- documentos ---------- */
.docs-head h2{ font-family: var(--font-display); font-size: 20px; margin: 12px 0 2px; }
.doc-tabs{ display:flex; gap:6px; margin: 14px 0; overflow-x:auto; padding-bottom:2px; }
.doc-tab{
  white-space:nowrap; background: var(--bg-raise); border: 1.5px solid var(--line); border-radius: 20px;
  padding: 8px 14px; font-size: 13px; font-weight:600; color: var(--ink-soft);
}
.doc-tab.active{ background: var(--ink); color:#fff; border-color: var(--ink); }

.upload-drop{
  display:flex; align-items:center; justify-content:center; gap:8px;
  border: 1.8px dashed var(--line); border-radius: var(--radius-md); padding: 18px;
  color: var(--accent2); font-weight:600; font-size: 14px; cursor:pointer; margin-bottom: 16px;
}
.upload-drop.small{ padding: 12px; font-size: 13px; margin-bottom: 6px; }

.doc-grid{ display:grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding-bottom: 20px; }
.doc-item{
  aspect-ratio: 1; border-radius: var(--radius-sm); overflow:hidden; position:relative;
  background: var(--bg-raise); box-shadow: var(--shadow-soft); cursor:pointer;
}
.doc-item img{ width:100%; height:100%; object-fit:cover; }
.doc-item .pdf-icon{ width:100%; height:100%; display:flex; align-items:center; justify-content:center; flex-direction:column; gap:4px; color: var(--accent2); font-size: 11px; font-weight:700; }
.doc-item .doc-date{ position:absolute; bottom:0; left:0; right:0; background: rgba(43,36,48,0.55); color:#fff; font-size:9.5px; padding:3px 5px; }
.doc-empty{ grid-column: 1/-1; text-align:center; color: var(--ink-soft); font-size: 13.5px; padding: 24px; }

/* ---------- ajustes ---------- */
.settings-block h2{ font-family: var(--font-display); font-size: 20px; margin: 12px 0 16px; }
.field-label{ display:block; font-size: 12.5px; font-weight:600; color: var(--ink-soft); margin: 14px 0 6px; }
.field-input{
  width:100%; border: 1.5px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px;
  font-size: 15px; background: var(--bg-raise); resize: vertical;
}
.field-input:focus{ outline: none; border-color: var(--accent); }
.primary-btn{
  width:100%; background: var(--ink); color:#fff; border:none; border-radius: var(--radius-sm);
  padding: 14px; font-size: 15px; font-weight:700; margin-top: 20px; cursor:pointer;
}
.ghost-btn{
  flex:1; background: var(--bg); color: var(--ink); border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  padding: 13px; font-size:14.5px; font-weight:600;
}
.danger-zone{ margin-top: 30px; padding-top: 18px; border-top: 1px solid var(--line); }
.danger-btn{ background: none; border: 1.5px solid #C97C93; color: #B4587A; border-radius: var(--radius-sm); padding: 11px 16px; font-weight:600; font-size:13.5px; margin-top:8px; }

/* ---------- bottom nav ---------- */
.bottom-nav{
  position: fixed; bottom:0; left:0; right:0; background: var(--bg-raise);
  display:flex; box-shadow: 0 -6px 20px rgba(43,36,48,0.08);
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
  z-index: 40;
}
.nav-item{
  flex:1; background:none; border:none; display:flex; flex-direction:column; align-items:center; gap:3px;
  color: var(--ink-soft); font-size: 10.5px; padding: 6px 0; font-weight:600; cursor:pointer;
}
.nav-item.active{ color: var(--accent2); }

/* ---------- modal ---------- */
.modal-overlay{
  position: fixed; inset:0; background: rgba(43,36,48,0.4); z-index: 60;
  display:flex; align-items:flex-end; justify-content:center;
}
.modal-sheet{
  background: var(--bg); width:100%; max-width: 480px; border-radius: 28px 28px 0 0;
  padding: 10px 22px 26px; max-height: 88vh; overflow-y:auto;
}
.modal-handle{ width: 42px; height:4px; background: var(--line); border-radius: 3px; margin: 6px auto 14px; }
.modal-sheet h3{ font-family: var(--font-display); font-size: 18px; margin: 0 0 6px; }
.chip-row{ display:flex; gap:6px; flex-wrap:wrap; }
.chip{
  border: 1.5px solid var(--line); background: var(--bg-raise); border-radius: 20px; padding: 8px 13px;
  font-size: 12.5px; font-weight:600; color: var(--ink-soft);
}
.chip.active{ background: var(--accent); border-color: var(--accent); color: #fff; }
.modal-actions{ display:flex; gap:10px; margin-top: 22px; }
/* ambos botones exactamente iguales en tamaño */
.modal-actions .ghost-btn,
.modal-actions .primary-btn{
  flex: 1 1 0; width: auto; margin-top: 0;
  padding: 14px 10px; font-size: 14.5px; font-weight: 700;
  border-radius: var(--radius-sm); line-height: 1.2;
}
.modal-actions .ghost-btn{ border: 1.5px solid var(--line); }
.modal-actions .primary-btn{ border: 1.5px solid var(--ink); }

/* ---------- viewer ---------- */
.viewer-sheet{
  background: #000; width:100%; height: 100%;
  display:flex; flex-direction: column; position:relative;
}
#viewer-body{
  flex: 1 1 auto; min-height: 0;
  display:flex; align-items:center; justify-content:center; overflow:hidden;
}
.viewer-sheet img{ max-width:100%; max-height:100%; object-fit:contain; }
.viewer-sheet iframe{ width:100%; height:100%; border:none; background:#fff; }
.viewer-close.viewer-close{
  position:absolute; top: 16px; right: 16px; z-index:8;
  width: 40px; height: 40px; display:flex; align-items:center; justify-content:center;
  background: rgba(0,0,0,0.55); color:#fff; font-size: 18px; border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}

@media (max-width: 340px){
  .clock-wrap{ width: 210px; height:210px; }
  .clock-week{ font-size: 46px; }
}

/* ---------- modal de fecha del archivo ---------- */
.date-preview-box{
  margin: 14px 0 4px; height: 140px; border-radius: var(--radius-md);
  background: var(--accent-soft); overflow:hidden;
  display:flex; align-items:center; justify-content:center;
}
.date-preview-box img{ width:100%; height:100%; object-fit: contain; display:none; }
.date-preview-doc{ display:none; color: var(--accent2); }
.date-gest{
  font-family: var(--font-mono); font-size: 14px; font-weight:700;
  color: var(--accent2); margin: 10px 0 0; text-align:center;
}
.date-gest.invalid{ color: #b4453f; font-weight:600; font-family: var(--font-body); font-size: 12.5px; }

/* fecha tocable en la cuadrícula de archivos */
.doc-date{ cursor: pointer; }
.doc-date::after{ content: " ✎"; opacity:.7; font-size: 10px; }
.doc-date.no-edit{ cursor: default; }
.doc-date.no-edit::after{ content: ""; }

/* ---------- indicador de sincronización ---------- */
.sync-indicator{
  position:absolute; top: -1px; right: -1px; width: 10px; height: 10px;
  border-radius: 50%; background: var(--ink-soft); opacity:.4;
  border: 2px solid var(--bg);
}
.icon-btn{ position: relative; }
.sync-indicator.sync-ok{ background: #4f9d6e; opacity: 1; }
.sync-indicator.sync-off{ background: var(--ink-soft); opacity: .5; }
.sync-indicator.sync-busy{
  background: var(--accent2); opacity: 1;
  animation: sync-pulse 1s ease-in-out infinite;
}
@keyframes sync-pulse{ 0%,100%{ transform: scale(1); } 50%{ transform: scale(1.35); } }

/* ---------- tarjeta de estado de sincronización en Ajustes ---------- */
.sync-card{
  margin-top: 20px; padding: 14px 16px; border-radius: var(--radius-md);
  background: var(--bg-raise); box-shadow: var(--shadow-soft);
}
.sync-card-head{ display:flex; align-items:center; gap:8px; }
.sync-card-title{ font-weight:700; font-size: 13.5px; }
.sync-card .sync-indicator{ position: static; border: none; }
#sync-card-status{ margin: 6px 0 0; }

/* ---------- interruptor de notificaciones ---------- */
.notif-row{
  display:flex; align-items:center; justify-content:space-between;
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line);
}
.notif-label{ font-size: 13px; color: var(--ink); flex:1; padding-right: 12px; }
.notif-toggle{
  width: 46px; height: 27px; border-radius: 999px; border: none; position: relative;
  background: var(--accent-soft); flex-shrink: 0; cursor: pointer;
  transition: background .22s ease, opacity .2s ease;
}
.notif-toggle:disabled{ opacity: .55; cursor: default; }
.notif-toggle-knob{
  position:absolute; top: 3px; left: 3px; width: 21px; height: 21px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(43,36,48,.3);
  transition: transform .22s cubic-bezier(.4,0,.2,1);
}
.notif-toggle[data-state="on"]{ background: var(--accent2); }
.notif-toggle[data-state="on"] .notif-toggle-knob{ transform: translateX(19px); }
#notif-status{ margin: 8px 0 0; }

/* ---------- pantalla de acceso ---------- */
.login-gate{
  position: fixed; inset: 0; z-index: 200; background: var(--bg);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.login-card{
  width: 100%; max-width: 380px; background: var(--bg-raise);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lift);
  padding: 28px 22px;
}
.login-brand{ font-family: var(--font-display); font-size: 24px; font-weight:700; text-align:center; margin-bottom: 6px; }
.login-brand .brand-mark{ color: var(--accent2); }
.login-sub{ font-size: 13.5px; color: var(--ink-soft); text-align:center; margin: 0 0 20px; }
.login-error{ color: #b4453f; font-size: 13px; margin: 10px 0 0; }
.login-hint{ font-size: 12px; color: var(--ink-soft); text-align:center; margin: 14px 0 0; }
.login-card .primary-btn{ margin-top: 18px; width: 100%; }

/* ---------- corazón y comentarios en el visor ---------- */
/* Barra social flotante sobre la foto: la imagen siempre ocupa la
   pantalla completa; corazón + acceso a comentarios van encima. */
.viewer-social{
  position:absolute; left:0; right:0; bottom:0; z-index:4;
  background: linear-gradient(transparent, rgba(0,0,0,.74));
  color:#fff;
  padding: 34px 16px calc(14px + env(safe-area-inset-bottom));
}
.viewer-social .heart-btn{ color:#fff; }
.viewer-social .viewer-hearts-who{ color: rgba(255,255,255,.78); }
.viewer-social .viewer-del-btn{ color: rgba(255,255,255,.85); }
.comments-open-btn{
  display:inline-flex; align-items:center; gap:7px;
  background: rgba(255,255,255,.17); border:none; color:#fff;
  border-radius: 999px; padding: 8px 14px; font-size: 13px; font-weight:600;
  cursor:pointer; white-space:nowrap;
}

/* Hoja de comentarios: sube por encima de la foto, estilo Instagram */
.comments-sheet{
  position:absolute; left:0; right:0; bottom:0; z-index:6;
  background: var(--bg-raise); color: var(--ink);
  border-radius: 18px 18px 0 0; box-shadow: var(--shadow-lift);
  max-height: 72%; display:flex; flex-direction:column;
  padding: 2px 16px calc(12px + env(safe-area-inset-bottom));
  transform: translateY(105%);
  transition: transform .28s cubic-bezier(.2,.8,.25,1);
}
.comments-sheet.open{ transform: translateY(0); }
.comments-sheet-grab{
  background:none; border:none; width:100%; padding: 10px 0 2px;
  display:flex; justify-content:center; cursor:pointer;
}
.comments-sheet-title{
  font-size: 12px; font-weight:700; text-transform:uppercase;
  letter-spacing:.07em; color: var(--ink-soft); text-align:center; margin: 2px 0 6px;
}
.viewer-social-bar{ display:flex; align-items:center; gap:14px; }
.heart-btn{
  display:inline-flex; align-items:center; gap:7px; background:none; border:none;
  color: var(--ink-soft); cursor:pointer; font-family: var(--font-mono); font-size: 15px; font-weight:700;
  padding: 4px 2px;
}
.heart-btn.liked{ color: #d6336c; }
.heart-btn.liked #viewer-heart-path{ fill: #d6336c; stroke: #d6336c; opacity: .55; }
.heart-btn.mine #viewer-heart-path{ opacity: 1; }
.viewer-hearts-who{ font-size: 12px; color: var(--ink-soft); flex:1; }

.viewer-comments{ margin-top: 4px; display:flex; flex-direction:column; gap:10px; flex:1 1 auto; overflow-y:auto; min-height: 64px; }
.comment-row{ background: var(--bg); border-radius: var(--radius-sm); padding: 9px 12px; }
.comment-who{ font-size: 12px; font-weight:700; color: var(--accent2); }
.comment-text{ font-size: 13.5px; color: var(--ink); margin-top: 2px; word-break: break-word; }
.comment-empty{ font-size: 12.5px; color: var(--ink-soft); text-align:center; padding: 6px 0; }
.comment-actions{ float:right; display:flex; gap:10px; }
.comment-del, .comment-edit{ background:none; border:none; color: var(--ink-soft); font-size: 12px; cursor:pointer; padding: 0; }
.comment-edit{ color: var(--accent2); }
.comment-edit-box{ display:flex; gap:8px; margin-top: 4px; align-items:center; }
.comment-edit-box .field-input{ flex:1; min-width:0; margin:0; padding: 6px 10px; font-size: 13px; }
.comment-edit-save{ flex:0 0 auto; }

.viewer-comment-add{ display:flex; gap:8px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); align-items:center; flex:0 0 auto; }
.viewer-comment-add .field-input{ flex:1; min-width:0; margin:0; }
.viewer-comment-add .fab-mini{ flex:0 0 auto; white-space:nowrap; }

/* elementos que solo ven los administradores */
body.viewer-role .admin-only{ display:none !important; }

/* corazón mini sobre la miniatura de archivos */
.doc-hearts{
  position:absolute; top:8px; right:8px; background: rgba(43,36,48,.62); color:#fff;
  font-family: var(--font-mono); font-size: 11px; font-weight:700; padding: 3px 8px 3px 6px;
  border-radius: 20px; display:inline-flex; align-items:center; gap:3px;
}

.viewer-doccard{
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:14px; padding: 40px 24px; color: var(--accent2); text-align:center;
}
.viewer-doccard-name{ font-size: 14px; font-weight:600; color: var(--ink); word-break: break-word; }

/* ---------- gestión de usuarios ---------- */
.code-row{ display:flex; align-items:center; justify-content:space-between; padding: 8px 0; border-bottom: 1px solid var(--line); }
.code-label{ font-size: 13px; color: var(--ink-soft); }
.code-val{ font-family: var(--font-mono); font-weight:700; font-size: 14px; color: var(--ink); }
.members-list{ margin-top: 12px; display:flex; flex-direction:column; gap:8px; }
.member-row{ display:flex; align-items:center; justify-content:space-between; gap:8px; }
.member-name{ font-size: 13.5px; }
.member-name .badge{ font-size: 10.5px; font-family: var(--font-mono); color: var(--accent2); margin-left: 6px; }
.member-toggle{ background: var(--accent-soft); border:none; border-radius: 20px; padding: 5px 12px; font-size: 12px; font-weight:600; cursor:pointer; color: var(--ink); }

.viewer-del-btn{ background:none; border:none; color:#b4453f; cursor:pointer; padding:4px; margin-left:auto; }

.diagnose-output{
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px; margin: 10px 0; font-family: var(--font-mono); font-size: 11.5px;
  white-space: pre-wrap; word-break: break-word; color: var(--ink); line-height: 1.5;
}

/* ---------- ajustes en modo solo-ver ---------- */
body.viewer-role #btn-save-settings{ display:none; }
.field-input:disabled, .sex-btn:disabled{
  opacity:.55; cursor:default; pointer-events:none;
}

/* botón para quitar un miembro de la lista */
.member-remove{
  background:none; border:none; color:#b4453f; cursor:pointer;
  font-size: 14px; padding: 4px 8px; margin-left: 4px; border-radius: 8px;
}
.member-row{ display:flex; align-items:center; gap:6px; }
.member-row .member-name{ flex:1; min-width:0; }

/* ---------- v31: nombre del bebé, miniaturas PDF, logo ---------- */
.stat-mother{
  display:block; font-family: var(--font-display);
  font-size: 22px; font-weight: 700; color: var(--accent2);
  letter-spacing: .02em; margin-bottom: 3px;
}
.stat-baby{
  display:block; margin-top: 7px; padding-top: 7px;
  border-top: 1px solid var(--line);
  font-size: 13.5px; color: var(--ink-soft); font-weight: 600;
}
.stat-baby b{ font-family: var(--font-display); font-size: 16px; color: var(--accent2); font-weight:700; }
.pdf-chip{
  position:absolute; top:7px; left:7px; z-index:2;
  background: rgba(43,36,48,.72); color:#fff;
  font-family: var(--font-mono); font-size: 10px; font-weight:700;
  letter-spacing:.06em; padding: 3px 7px; border-radius: 7px;
}
.doc-item{ position:relative; }
.viewer-doccard-thumb{
  max-width: 72%; max-height: 46vh; border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.45); display:block; margin: 0 auto 6px;
}
.brand-logo{ display:inline-block; vertical-align: -5px; }
.login-brand .brand-logo{ width: 27px; height: 27px; vertical-align: -6px; }

/* ---------- v33: hoja de "Me gusta" ---------- */
.likes-sheet{ max-height: 52%; }
.likes-list{ flex:1 1 auto; overflow-y:auto; padding: 2px 4px 8px; }
.like-row{
  display:flex; align-items:center; gap:12px;
  padding: 11px 6px; border-bottom: 1px solid var(--line);
}
.like-row:last-child{ border-bottom:none; }
.like-row-heart{ color:#e0426b; font-size: 16px; }
.like-row-name{ font-weight:600; font-size: 14.5px; }
.viewer-social .viewer-hearts-who{ cursor:pointer; }
.viewer-social #viewer-heart-count{ cursor:pointer; }

/* ---------- v35: autor administrador en los comentarios ---------- */
.comment-who.is-admin{ color: var(--accent2); }
.comment-admin-tag{
  margin-left: 6px; font-family: var(--font-mono);
  font-size: 9.5px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--accent2);
  background: color-mix(in srgb, var(--accent2) 15%, transparent);
  padding: 2px 6px; border-radius: 6px; vertical-align: 1px;
}

/* aviso cuando aún no hay fecha de última menstruación configurada */
.no-lmp-hint{
  margin: 0 0 12px; padding: 11px 14px; border-radius: var(--radius-md);
  background: var(--accent-soft); color: var(--ink-soft);
  font-size: 13px; font-weight: 600; text-align: center;
}
