/* ══ AstroKarmica Social · estilos compartidos (según DESIGN.md) ══ */

:root {
  --ak-ink:        #2F2B28;
  --ak-graphite:   #504B48;
  --ak-gold:       #DEC87F;
  --ak-gold-light: #EAD285;
  --ak-ivory:      #F9F1E8;
  --ak-sand:       #E5D3C7;
  --ak-white:      #FFFFFF;
  --ak-mist:       #D8D3C9;
  --ak-rose:       #D7BEB0;
  --ak-terracotta: #A98373;
  --ak-sage:       #C9D2C2;
  --ak-night:      #1E1B17;
  --ak-night-card: #2A2520;
  --ak-conj:  #DEC87F;
  --ak-sext:  #A98373;
  --ak-squa:  #C97B6A;
  --ak-trin:  #8BA888;
  --ak-oppo:  #B8936A;
  --radius-card: 20px;
  --radius-sm:   12px;
  --radius-pill: 999px;
  --shadow-soft: 0 4px 24px rgba(47,43,40,.08);
  --shadow-card: 0 8px 40px rgba(47,43,40,.10);
  --font-title: "Cormorant Garamond", "EB Garamond", Georgia, serif;
  --font-ui:    "Inter", "Lato", system-ui, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--ak-ivory);
  color: var(--ak-ink);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

h1, h2 { font-family: var(--font-title); font-weight: 600; line-height: 1.25; }
h3 { font-family: var(--font-title); font-style: italic; font-weight: 600; }

a { color: var(--ak-terracotta); text-decoration: none; }

.page {
  max-width: 680px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 6.5rem;
  min-height: 100vh;
}

/* ── Header de página ── */
.page-header { margin: .75rem 0 1.5rem; }
.page-header h1 { font-size: 2rem; }
.page-header .sub {
  color: var(--ak-graphite);
  font-size: .92rem;
  margin-top: .2rem;
}

/* ── Tarjeta ── */
.card {
  background: var(--ak-white);
  border: 1px solid var(--ak-sand);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-soft);
  padding: 1.4rem 1.5rem;
  margin-bottom: 1.1rem;
}
.card.night {
  background: var(--ak-night);
  border-color: #3a332c;
  color: var(--ak-ivory);
}

/* ── Botones ── */
.btn-primary {
  background: var(--ak-ink);
  color: var(--ak-ivory);
  border: none;
  border-radius: var(--radius-pill);
  font-family: var(--font-ui);
  font-size: .95rem;
  font-weight: 600;
  letter-spacing: .04em;
  padding: .85rem 2rem;
  cursor: pointer;
  transition: background .2s, box-shadow .2s;
}
.btn-primary:hover { background: var(--ak-graphite); box-shadow: 0 6px 24px rgba(47,43,40,.20); }
.btn-primary:disabled { opacity: .45; cursor: default; }

.btn-secondary {
  background: transparent;
  color: var(--ak-terracotta);
  border: 1px solid var(--ak-gold);
  border-radius: var(--radius-pill);
  font-family: var(--font-ui);
  font-size: .9rem;
  font-weight: 600;
  padding: .7rem 1.6rem;
  cursor: pointer;
  transition: background .2s;
}
.btn-secondary:hover { background: rgba(222,200,127,.12); }

/* ── Formularios ── */
label {
  display: block;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--ak-graphite);
  margin-bottom: .4rem;
}
input, select, textarea {
  width: 100%;
  background: var(--ak-white);
  border: 1px solid var(--ak-sand);
  border-radius: var(--radius-sm);
  color: var(--ak-ink);
  font-family: var(--font-ui);
  font-size: 1rem;
  padding: .8rem 1rem;
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--ak-gold);
  box-shadow: 0 0 0 3px rgba(222,200,127,.18);
}

/* ── Badge ── */
.badge {
  display: inline-block;
  background: rgba(222,200,127,.12);
  border: 1px solid rgba(222,200,127,.35);
  color: var(--ak-graphite);
  border-radius: var(--radius-pill);
  font-size: .74rem;
  font-weight: 600;
  letter-spacing: .05em;
  padding: .18rem .7rem;
}
.badge.rose { background: rgba(215,190,176,.18); border-color: var(--ak-rose); }
.badge.sage { background: rgba(201,210,194,.25); border-color: var(--ak-sage); }

/* ── Divisor ── */
.divider { border: none; border-top: 1px solid var(--ak-sand); margin: 1.2rem 0; }
.divider-gold { border: none; border-top: 1px solid var(--ak-gold); opacity: .4; margin: 1.2rem 0; }

/* ── Tab bar inferior (iconos CON etiquetas — lección de Co-Star) ── */
.tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--ak-white);
  border-top: 1px solid var(--ak-sand);
  display: flex;
  justify-content: space-around;
  padding: .5rem 0 calc(.5rem + env(safe-area-inset-bottom));
  z-index: 100;
  /* Capa de composición propia: sin ella, iOS Safari puede dejar la barra
     "pegada" a mitad de página durante los scrolls suaves programados. */
  transform: translateZ(0);
}
.tabbar a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .1rem;
  color: var(--ak-graphite);
  font-size: .64rem;
  font-weight: 600;
  letter-spacing: .02em;
  flex: 1 1 0;
  min-width: 0;
  white-space: nowrap;
}
.tabbar a .ticon { font-size: 1.25rem; line-height: 1.2; opacity: .75; }
.tabbar a .ticon svg {
  width: 22px; height: 22px; display: block; margin: 2px auto 1px;
  fill: none; stroke: currentColor; stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round;
}
/* Activa en dorado (rediseño "Mi Cielo" 2026-07-14, antes tinta + subrayado) */
.tabbar a.active { color: #A67323; }
.tabbar a.active .ticon { opacity: 1; color: #B88432; }

/* ── Loading ── */
.loading-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 50vh;
  gap: 1.25rem;
  text-align: center;
}
.loading-block p {
  font-family: var(--font-title);
  font-style: italic;
  font-size: 1.05rem;
  color: var(--ak-graphite);
  max-width: 300px;
}
.spinner {
  width: 40px; height: 40px;
  border: 2px solid var(--ak-sand);
  border-top-color: var(--ak-gold);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.shimmer {
  background: linear-gradient(90deg, rgba(229,211,199,.35) 25%, rgba(229,211,199,.65) 50%, rgba(229,211,199,.35) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
  min-height: 1rem;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ── Secciones del perfil profundo ── */
.section-card { cursor: pointer; transition: box-shadow .2s; }
.section-card:hover { box-shadow: var(--shadow-card); }
.section-card .sec-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.section-card h2 { font-size: 1.35rem; }
.section-card .sec-sub { color: var(--ak-graphite); font-size: .88rem; font-style: italic; font-family: var(--font-title); }
.sec-body { margin-top: 1rem; display: none; }
.section-card.open .sec-body { display: block; }
.sec-chevron { color: var(--ak-gold); font-size: 1.1rem; transition: transform .25s; }
.section-card.open .sec-chevron { transform: rotate(90deg); }

.block-label {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ak-terracotta);
  margin: 1.1rem 0 .3rem;
}
.block-label:first-child { margin-top: 0; }
.block-label.gold { color: #b39b4e; }

.essence-line {
  font-family: var(--font-title);
  font-style: italic;
  font-size: 1.12rem;
  color: var(--ak-ink);
  border-left: 2px solid var(--ak-gold);
  padding-left: .9rem;
  margin: 1rem 0 .2rem;
}

/* ── Toggle ¿Por qué? (transparencia astrológica) ── */
.why-toggle {
  background: none;
  border: none;
  color: var(--ak-terracotta);
  font-family: var(--font-ui);
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  padding: .4rem 0 0;
  letter-spacing: .03em;
}
.why-box {
  display: none;
  background: var(--ak-ivory);
  border: 1px solid var(--ak-sand);
  border-radius: var(--radius-sm);
  font-size: .88rem;
  color: var(--ak-graphite);
  padding: .8rem 1rem;
  margin-top: .6rem;
}
.why-box.show { display: block; }

/* ── Barras / medidores (vínculos) ── */
.meter { margin-bottom: .85rem; }
.meter .meter-head {
  display: flex; justify-content: space-between;
  font-size: .82rem; font-weight: 600; color: var(--ak-graphite);
  margin-bottom: .25rem;
}
.meter .meter-track {
  height: 6px;
  background: rgba(229,211,199,.5);
  border-radius: 3px;
  overflow: hidden;
}
.meter .meter-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--ak-gold), var(--ak-terracotta));
  border-radius: 3px;
  transition: width .8s ease;
}

/* ── Timeline de ciclos ── */
.cycle-card .cyc-dates {
  font-size: .82rem;
  color: var(--ak-graphite);
  letter-spacing: .02em;
}
.cycle-progress {
  height: 5px;
  background: rgba(229,211,199,.5);
  border-radius: 3px;
  margin: .7rem 0 .3rem;
  position: relative;
  overflow: visible;
}
.cycle-progress .fill {
  height: 100%;
  background: var(--ak-gold);
  border-radius: 3px;
}
.cycle-progress .peak {
  position: absolute;
  top: -3px;
  width: 3px; height: 11px;
  background: var(--ak-terracotta);
  border-radius: 2px;
}

/* ── Tabla de datos (carta) ── */
.data-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.data-table th {
  background: var(--ak-ivory);
  color: var(--ak-graphite);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--ak-sand);
  padding: .55rem .6rem;
  text-align: left;
}
.data-table td {
  color: var(--ak-ink);
  border-bottom: 1px solid rgba(229,211,199,.5);
  padding: .55rem .6rem;
}
.data-table tr:hover td { background: rgba(249,241,232,.6); }
.data-table .glyph { font-size: 1.1rem; color: var(--ak-terracotta); }

/* ── Big three chips ── */
.bigthree { display: flex; gap: .6rem; flex-wrap: wrap; }
.bigthree .bt {
  flex: 1;
  min-width: 100px;
  background: var(--ak-white);
  border: 1px solid var(--ak-sand);
  border-radius: var(--radius-sm);
  text-align: center;
  padding: .8rem .5rem;
}
.bigthree .bt .bt-glyph { font-size: 1.5rem; color: var(--ak-terracotta); }
.bigthree .bt .bt-label {
  font-size: .68rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--ak-graphite);
}
.bigthree .bt .bt-sign { font-family: var(--font-title); font-size: 1.05rem; font-weight: 600; }

/* ── Listas de perfiles/vínculos ── */
.person-row {
  display: flex;
  align-items: center;
  gap: .9rem;
  padding: .8rem .2rem;
  border-bottom: 1px solid rgba(229,211,199,.5);
  cursor: pointer;
}
.person-row:last-child { border-bottom: none; }
.person-row .avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--ak-night);
  color: var(--ak-gold);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-title);
  font-size: 1.15rem;
  flex-shrink: 0;
}
.person-row .p-name { font-weight: 600; font-size: .95rem; }
.person-row .p-meta { font-size: .8rem; color: var(--ak-graphite); }
.person-row .p-right { margin-left: auto; text-align: right; }

/* ── Error ── */
.error-block {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--ak-graphite);
}
.error-block p { font-family: var(--font-title); font-style: italic; font-size: 1.05rem; margin-bottom: 1.2rem; }

/* ── Toast ── */
#toast {
  position: fixed;
  bottom: 84px; left: 50%;
  transform: translateX(-50%);
  background: var(--ak-ink);
  color: var(--ak-ivory);
  border-radius: var(--radius-pill);
  font-size: .85rem;
  padding: .6rem 1.3rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s;
  z-index: 200;
  max-width: 90vw;
  text-align: center;
}
#toast.show { opacity: 1; }

@media (max-width: 480px) {
  .page { padding: 1rem 1rem 6.5rem; }
  .page-header h1 { font-size: 1.65rem; }
}

/* ── Control global de tamaño de letra (Aa) ──
   Disponible en todas las secciones excepto /hoy (tiene el suyo propio).
   Usa px fijos para el propio botón/popover: no debe autoescalarse. */
.ak-fs-toggle {
  position: fixed;
  right: 16px;
  top: calc(env(safe-area-inset-top) + 12px);
  z-index: 290;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--ak-sand);
  background: rgba(255, 255, 255, .94);
  color: var(--ak-graphite);
  font: 600 15px/1 var(--font-ui);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(9px);
  cursor: pointer;
}
.ak-fs-pop {
  position: fixed;
  right: 14px;
  top: calc(env(safe-area-inset-top) + 62px);
  z-index: 291;
  background: var(--ak-white);
  border: 1px solid var(--ak-sand);
  border-radius: 18px;
  padding: 13px 16px;
  box-shadow: var(--shadow-card);
}
.ak-fs-pop .ak-fs-title { font: 600 12.5px var(--font-ui); color: var(--ak-graphite); margin-bottom: 10px; }
.ak-fs-controls { display: flex; align-items: center; gap: 13px; }
.ak-fs-controls button {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--ak-sand);
  background: #fff;
  color: var(--ak-ink);
  font: 400 20px/1 var(--font-ui);
  cursor: pointer;
}
#ak-fs-value { min-width: 52px; text-align: center; font: 600 14.7px var(--font-ui); color: var(--ak-ink); }

/* ── Interruptor de modo de lectura: Simple / Astrológica ── */
.mode-switch {
  display: inline-flex;
  border: 1px solid var(--ak-sand);
  border-radius: var(--radius-pill);
  background: var(--ak-white);
  overflow: hidden;
}
.mode-switch button {
  border: none;
  background: none;
  font-family: var(--font-ui);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--ak-graphite);
  padding: .38rem .75rem;
  cursor: pointer;
  transition: background .2s, color .2s;
  white-space: nowrap;
}
.mode-switch button.on {
  background: rgba(222,200,127,.22);
  color: var(--ak-ink);
}
.header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: .8rem;
}

/* ── Selector de tipo de relación (vínculos) ── */
.sheet-overlay {
  position: fixed; inset: 0;
  background: rgba(26,24,21,.45);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 300;
}
.sheet {
  background: var(--ak-ivory, #FAF6ED);
  border-radius: 18px 18px 0 0;
  padding: 1.4rem 1.2rem 1.6rem;
  width: 100%; max-width: 520px;
}
.sheet-title {
  font-family: var(--font-title);
  font-size: 1.35rem; font-weight: 600;
}
.sheet-sub { font-size: .85rem; color: var(--ak-graphite); margin: .2rem 0 1rem; }
.sheet-opt {
  display: flex; align-items: center; gap: .7rem;
  width: 100%;
  background: var(--ak-white);
  border: 1px solid var(--ak-sand);
  border-radius: 12px;
  font-family: var(--font-ui);
  font-size: .95rem; font-weight: 600;
  color: var(--ak-ink);
  padding: .8rem 1rem;
  margin-bottom: .55rem;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.sheet-opt:hover { border-color: var(--ak-gold); background: rgba(222,200,127,.12); }
.sheet-opt span { color: var(--ak-terracotta); }
.sheet-cancel {
  width: 100%;
  background: none; border: none;
  font-family: var(--font-ui); font-size: .85rem;
  color: var(--ak-graphite);
  padding: .6rem; margin-top: .2rem;
  cursor: pointer;
}

/* Pills para cambiar el tipo de relación en el detalle del vínculo */
.rel-pills { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: center; margin-top: .9rem; }
.rel-pills button {
  background: rgba(250,246,237,.12);
  border: 1px solid rgba(250,246,237,.35);
  border-radius: var(--radius-pill);
  font-family: var(--font-ui);
  font-size: .72rem; font-weight: 600;
  color: rgba(250,246,237,.85);
  padding: .32rem .7rem;
  cursor: pointer;
  transition: background .2s, border-color .2s;
}
.rel-pills button.on {
  background: var(--ak-gold);
  border-color: var(--ak-gold);
  color: var(--ak-ink);
}

/* Miembro seleccionado en la hoja de crear grupo */
.sheet-opt.on { border-color: var(--ak-gold); background: rgba(222,200,127,.18); }

/* Chips del tipo de relación del grupo (hoja de crear grupo, fondo claro) */
.rel-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .35rem; }
.rel-chip {
  background: var(--ak-white);
  border: 1px solid var(--ak-sand);
  border-radius: var(--radius-pill);
  font-family: var(--font-ui);
  font-size: .8rem; font-weight: 600;
  color: var(--ak-graphite);
  padding: .38rem .8rem;
  cursor: pointer;
  transition: background .2s, border-color .2s;
}
.rel-chip.on {
  background: rgba(222,200,127,.18);
  border-color: var(--ak-gold);
  color: var(--ak-ink);
}
