/* ------------------------------------------------------------------
   UTERINA · app de pareja
   Paleta tomada del logo: crema, blush y terracota.
   Mobile-first; en escritorio se centra en un marco para probarla cómodo.
------------------------------------------------------------------- */

:root {
  --cream:    #f8ede6;
  --cream-2:  #f2e1d8;
  --surface:  #fffaf7;
  --surface-2:#f6e8e0;
  --line:     #e8d2c6;
  --line-2:   #ddbfb0;

  --ink:      #4e2c23;
  --ink-2:    #8a6355;
  --ink-3:    #ab8878;

  --blush:    #e9cabc;
  --rose:     #cc907d;
  --terra:    #a85c49;
  --deep:     #864333;

  --ok:       #6f9578;
  --warn:     #c08a43;
  --alert:    #b6564a;

  --radius:   18px;
  --radius-s: 12px;
  --shadow:   0 2px 10px rgba(134, 67, 51, .06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--cream-2);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100%;
  overscroll-behavior-y: none;
  /* Nada puede empujar la página a los costados. */
  overflow-x: hidden;
  max-width: 100%;
}

.phone {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--cream);
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
@media (min-width: 520px) {
  body { padding: 24px 0; background: #e7d2c6; }
  .phone { min-height: calc(100dvh - 48px); border-radius: 30px; box-shadow: 0 20px 60px rgba(78,44,35,.18); }
}

.screen { display: none; flex-direction: column; flex: 1; min-height: 0; }
.screen.active { display: flex; }
.hidden { display: none !important; }

/* ---------------- AUTH ---------------- */

.auth { overflow-y: auto; }
.auth-wrap { padding: 30px 20px 40px; padding-top: calc(26px + env(safe-area-inset-top)); }

.brand { text-align: center; margin-bottom: 24px; }
.brand-logo { width: 116px; height: 116px; display: block; margin: 0 auto; border-radius: 50%; }
.brand h1 {
  margin: 6px 0 4px; font-size: 30px; font-weight: 400; letter-spacing: 7px;
  color: var(--deep); text-transform: uppercase; padding-left: 7px;
}
.tag {
  margin: 0; color: var(--terra); font-size: 11px; letter-spacing: 2.4px;
  text-transform: uppercase; font-weight: 500;
}
.tag-2 { margin: 12px auto 0; color: var(--ink-2); font-size: 13.5px; line-height: 1.55; max-width: 300px; letter-spacing: 0; text-transform: none; }

.tabs { display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 13px; margin-bottom: 16px; }
.tab {
  flex: 1; border: 0; background: transparent; color: var(--ink-2);
  padding: 10px; border-radius: 10px; font-size: 14px; font-weight: 600; cursor: pointer;
  font-family: inherit; transition: .16s;
}
.tab.active { background: var(--surface); color: var(--deep); box-shadow: var(--shadow); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 14px; }

.form { display: flex; flex-direction: column; gap: 13px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--ink-2); font-weight: 600; }
.row { display: flex; gap: 10px; }
.row > label { flex: 1; min-width: 0; }
.opt { color: var(--ink-3); font-weight: 400; }

input, select, textarea {
  background: var(--cream);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: var(--radius-s);
  padding: 11px 12px;
  font-size: 16px; /* 16px evita que iPhone haga zoom al enfocar */
  font-family: inherit;
  width: 100%;
  transition: border-color .15s, background .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--rose); background: #fff; }
input:disabled { color: var(--ink-3); }
textarea { resize: vertical; min-height: 84px; line-height: 1.5; }

.step-label {
  margin: 6px 0 -2px; font-size: 10.5px; letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--terra); font-weight: 700;
}
#cycle-fields, #code-field { display: flex; flex-direction: column; gap: 13px; }

.btn {
  border: 1px solid var(--line-2); background: var(--surface); color: var(--deep);
  border-radius: var(--radius-s); padding: 13px 16px; font-size: 15px; font-weight: 600;
  cursor: pointer; font-family: inherit; transition: .15s; width: 100%;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: linear-gradient(135deg, var(--rose), var(--terra)); border: 0; color: #fff; box-shadow: 0 3px 12px rgba(168,92,73,.25); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; }
.btn.small { padding: 9px 13px; font-size: 13px; width: auto; }
.btn.danger { color: var(--alert); border-color: #e3bdb6; background: transparent; }

.err { color: var(--alert); font-size: 13px; margin: 0; }
.err:empty { display: none; }

.site-link { text-align: center; margin: 22px 0 0; }
.site-link a {
  color: var(--terra); font-size: 13.5px; font-weight: 600; text-decoration: none;
  border-bottom: 1px solid var(--line-2); padding-bottom: 2px; transition: .15s;
}
.site-link a:hover { color: var(--deep); border-color: var(--terra); }

.legal { color: var(--ink-3); font-size: 11.5px; line-height: 1.55; margin-top: 14px; text-align: center; }
.hint { color: var(--ink-2); font-size: 12px; line-height: 1.6; margin: 0; }

/* selector hombre / mujer */
.gender-pick { display: flex; gap: 10px; }
.gpick { flex: 1; cursor: pointer; }
.gpick input { position: absolute; opacity: 0; pointer-events: none; }
.gcard {
  display: block; padding: 13px; border: 1.5px solid var(--line); border-radius: var(--radius-s);
  background: var(--cream); transition: .16s; height: 100%;
}
.gcard b { display: block; font-size: 15px; margin-bottom: 4px; color: var(--ink); }
.gcard small { color: var(--ink-2); font-size: 11.5px; line-height: 1.45; display: block; }
.gpick input:checked + .gcard { border-color: var(--terra); background: #fdf1ec; }
.gpick input:checked + .gcard b { color: var(--terra); }

/* ---------------- APP SHELL ---------------- */

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px 12px; padding-top: calc(14px + env(safe-area-inset-top));
  border-bottom: 1px solid var(--line); flex-shrink: 0; background: var(--surface);
}
.topbar-user { display: flex; align-items: center; gap: 11px; min-width: 0; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--blush), var(--rose));
  display: grid; place-items: center; font-weight: 700; font-size: 14px; color: #fff;
}
.hello { font-size: 15.5px; font-weight: 600; color: var(--deep); }
.sub { font-size: 12px; color: var(--ink-3); }
.icon-btn {
  background: transparent; border: 1px solid var(--line); color: var(--ink-2);
  width: 34px; height: 34px; border-radius: 10px; cursor: pointer; font-size: 14px;
}
.icon-btn:hover { background: var(--surface-2); }

main#views { flex: 1; overflow-y: auto; padding: 16px 16px 26px; -webkit-overflow-scrolling: touch; }

.tabbar {
  display: flex; border-top: 1px solid var(--line); background: var(--surface); flex-shrink: 0;
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar button {
  flex: 1; background: transparent; border: 0; color: var(--ink-3);
  padding: 9px 2px 11px; font-size: 10.5px; cursor: pointer; font-family: inherit;
  display: flex; flex-direction: column; align-items: center; gap: 3px; font-weight: 600;
}
.tabbar button span { font-size: 17px; filter: grayscale(1); opacity: .5; transition: .15s; }
.tabbar button.active { color: var(--terra); }
.tabbar button.active span { filter: none; opacity: 1; }

/* ---------------- COMPONENTES ---------------- */

.sec-title { font-size: 10.5px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--terra); font-weight: 700; margin: 22px 0 9px; }
.sec-title:first-child { margin-top: 2px; }

.phase-hero {
  border-radius: var(--radius); padding: 20px; border: 1px solid var(--line);
  position: relative; overflow: hidden; background: var(--surface); box-shadow: var(--shadow);
}
.phase-hero::before {
  content: ''; position: absolute; inset: 0; opacity: .16;
  background: radial-gradient(120% 100% at 12% 0%, var(--ph, var(--rose)), transparent 62%);
}
.phase-hero > * { position: relative; }
.phase-emoji { font-size: 29px; line-height: 1; }
.phase-name { font-size: 21px; font-weight: 650; margin: 9px 0 2px; color: var(--deep); }
.phase-day { color: var(--ink-2); font-size: 13px; }
.phase-body { margin: 13px 0 0; font-size: 13.5px; line-height: 1.65; color: var(--ink-2); }

.signal-card { border-left: 3px solid var(--lv, var(--ink-3)); }
.signal-head { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--lv); flex-shrink: 0; }
.signal-head b { font-size: 15px; color: var(--deep); }
.lv-verde   { --lv: var(--ok); }
.lv-neutral { --lv: #8a93b5; }
.lv-ambar   { --lv: var(--warn); }
.lv-rojo    { --lv: var(--alert); }

ul.tips { margin: 10px 0 0; padding-left: 18px; color: var(--ink-2); font-size: 13px; line-height: 1.65; }
ul.tips li + li { margin-top: 5px; }

/* bloques "qué no decir" / "qué sí funciona" */
.advice { border-radius: var(--radius-s); padding: 13px; margin-top: 12px; border: 1px solid; }
.advice.bad  { background: #fdf0ee; border-color: #f0cdc7; }
.advice.good { background: #f0f6f1; border-color: #cfe1d4; }
.advice-head { font-size: 11px; font-weight: 800; letter-spacing: .6px; margin-bottom: 8px; text-transform: uppercase; }
.advice.bad  .advice-head { color: #a8463c; }
.advice.good .advice-head { color: #4f7a5d; }
.advice-quote { margin: 0; font-size: 13.5px; line-height: 1.55; color: var(--ink); }
.advice-quote + .advice-quote { margin-top: 9px; }
.advice-why { margin: 7px 0 0; font-size: 12px; line-height: 1.55; color: var(--ink-2); }
.advice-when { color: var(--ink-3); font-size: 11px; display: block; margin-top: 2px; }

.disclaimer {
  background: var(--cream); border: 1px dashed var(--line-2); border-radius: var(--radius-s);
  padding: 11px 13px; color: var(--ink-2); font-size: 11.5px; line-height: 1.6; margin-top: 12px;
}

.notif { display: flex; gap: 11px; padding: 13px; border-radius: var(--radius-s); background: var(--surface); border: 1px solid var(--line); }
.notif + .notif { margin-top: 8px; }
.notif-ic { font-size: 17px; line-height: 1.2; }
.notif b { display: block; font-size: 13.5px; margin-bottom: 3px; color: var(--deep); }
.notif p { margin: 0; color: var(--ink-2); font-size: 12.5px; line-height: 1.55; }
.notif.alta { border-color: var(--line-2); background: #fdf5f1; }

/* escalas 1-5 */
.scale { display: flex; gap: 6px; }
.scale button {
  flex: 1; padding: 11px 0; border-radius: var(--radius-s); border: 1px solid var(--line);
  background: var(--cream); color: var(--ink-2); cursor: pointer; font-size: 18px; font-family: inherit;
  transition: .14s;
}
.scale button.on { border-color: var(--terra); background: #fdf1ec; transform: translateY(-1px); }
.scale-legend { display: flex; justify-content: space-between; color: var(--ink-3); font-size: 11px; margin-top: 5px; }
.field-label { display: block; font-size: 12.5px; color: var(--ink-2); font-weight: 600; margin-bottom: 7px; }
.scale-block + .scale-block { margin-top: 16px; }

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  padding: 8px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--cream);
  color: var(--ink-2); font-size: 12.5px; cursor: pointer; font-family: inherit; transition: .14s;
}
.chip.on { border-color: var(--terra); background: #fdf1ec; color: var(--terra); font-weight: 600; }

.switch { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.switch input { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; accent-color: var(--terra); }
.switch span { font-size: 12.5px; color: var(--ink-2); line-height: 1.55; }

/* calendario */
.cal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.cal-head b { font-size: 15px; color: var(--deep); }
.cal-head b::first-letter { text-transform: uppercase; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal-dow { text-align: center; font-size: 10px; color: var(--ink-3); padding-bottom: 4px; font-weight: 700; }
.cal-cell {
  aspect-ratio: 1; border-radius: 10px; border: 1px solid transparent; background: var(--cream);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  font-size: 12px; color: var(--ink-2); cursor: pointer; position: relative; font-family: inherit;
}
.cal-cell.empty { background: transparent; cursor: default; }
.cal-cell.today { border-color: var(--terra); font-weight: 700; }
.cal-cell .em { font-size: 10px; line-height: 1; }
.cal-cell .mk { position: absolute; bottom: 4px; width: 4px; height: 4px; border-radius: 50%; background: var(--terra); }
.legend { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.legend span { font-size: 11px; color: var(--ink-3); display: flex; align-items: center; gap: 4px; }

/* listas */
.item { display: flex; align-items: center; gap: 11px; padding: 12px 13px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-s); }
.item + .item { margin-top: 8px; }
.item.done { opacity: .5; }
.item.done .item-title { text-decoration: line-through; }
.item-title { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.item-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.item-check {
  width: 22px; height: 22px; border-radius: 7px; border: 1.5px solid var(--line-2);
  background: var(--cream); cursor: pointer; flex-shrink: 0; color: var(--ok); font-size: 13px; font-weight: 700;
}
.grow { flex: 1; min-width: 0; }

.empty-state { text-align: center; padding: 26px 14px; color: var(--ink-3); font-size: 13px; line-height: 1.65; }

.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.bar-label { width: 108px; flex-shrink: 0; color: var(--ink-2); }
.bar-track { flex: 1; height: 8px; background: var(--cream-2); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--blush), var(--terra)); }
.bar-val { width: 34px; text-align: right; color: var(--ink-3); }

.toast {
  position: fixed; left: 50%; bottom: 84px; transform: translate(-50%, 20px);
  background: var(--deep); border: 0; color: #fff;
  padding: 11px 17px; border-radius: 999px; font-size: 13px; opacity: 0; pointer-events: none;
  transition: .25s; z-index: 50; max-width: 88%; text-align: center;
  box-shadow: 0 6px 20px rgba(78,44,35,.25);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* aviso de instalación en iPhone */
.ios-install {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(14px + env(safe-area-inset-bottom)); width: min(430px, calc(100% - 28px));
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius);
  padding: 15px 16px; z-index: 60; box-shadow: 0 10px 34px rgba(78,44,35,.2);
}
.ios-install b { font-size: 14px; color: var(--deep); }
.ios-install p { margin: 6px 0 0; font-size: 12.5px; color: var(--ink-2); line-height: 1.6; }
.ios-icon { color: var(--terra); }
.ios-close {
  position: absolute; top: 10px; right: 10px; background: transparent; border: 0;
  color: var(--ink-3); font-size: 14px; cursor: pointer; padding: 4px;
}
