/* Bloque «Apóyate en tu CFO» (sección .tucfo): lo usan la portada (index.html) y «empezar» (empezar.html).
   Lleva sus propios colores y medidas porque «empezar» no carga styles.css; son los mismos valores. */
.tucfo {
  --primary: #00303C;
  --white: #ffffff;
  --bg-suave: #F2F7F5;
  --text-muted: #64748b;
  --accent: #00A179;
  --accent-texto: #007A5C;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-20: 5rem;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-lg: 1.125rem;
}

.tucfo {
  padding: var(--space-20, 5rem) 0;
  background: var(--white);
}

.tucfo__cab {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: var(--space-6) var(--space-12, 3rem);
  align-items: end;
  margin-bottom: var(--space-10);
}

.tucfo__titulo {
  margin: 0;
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--primary);
  text-wrap: balance;
}

.tucfo__cab p {
  margin: 0;
  font-size: var(--text-lg);
  color: var(--text-muted);
}

.tucfo__cab strong {
  color: var(--primary);
}

.tucfo__tarjetas {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-5);
}

.tucfo__tarjeta {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  min-width: 0;
  padding: var(--space-8);
  border-radius: 22px;
}

.tucfo__tarjeta--chat {
  background: radial-gradient(120% 90% at 20% 0%, #0F4552 0%, #0B2A31 55%, #071E24 100%);
  color: var(--white);
}

.tucfo__tarjeta--sim {
  background: var(--bg-suave);
  border: 1px solid #DCE7E3;
}

.tucfo__barra {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-sm);
}

.tucfo__quien {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 600;
}

.tucfo__logo {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary);
}

.tucfo__logo svg {
  width: 18px;
  height: 18px;
}

.tucfo__pildora {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: var(--text-xs);
  white-space: nowrap;
}

.tucfo__tarjeta--chat .tucfo__pildora {
  background: rgba(255, 255, 255, 0.1);
  color: #CFE0DB;
}

.tucfo__tarjeta--sim .tucfo__pildora {
  background: var(--white);
  border: 1px solid #DCE7E3;
  color: var(--text-muted);
}

.tucfo__punto {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #00CB94;
}

/* La conversación: los mensajes ocupan siempre su sitio; con la animación solo cambian de opacidad */
.tucfo__chat {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tucfo__globo {
  max-width: 86%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.9rem;
  line-height: 1.45;
  transition: opacity 0.35s, transform 0.35s;
}

.tucfo__globo--cfo {
  align-self: flex-start;
  border-top-left-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  color: #E8F2EF;
}

.tucfo__globo--yo {
  align-self: flex-end;
  border-top-right-radius: 6px;
  background: var(--white);
  color: var(--primary);
}

.tucfo__prop {
  align-self: flex-start;
  width: 100%;
  max-width: 340px;
  padding: 14px;
  border-radius: 14px;
  background: var(--white);
  color: var(--primary);
  font-size: var(--text-sm);
  transition: opacity 0.35s, transform 0.35s;
}

.tucfo--anima .tucfo__globo,
.tucfo--anima .tucfo__prop {
  opacity: 0;
  transform: translateY(6px);
}

.tucfo--anima .tucfo__chat .tucfo__ver {
  opacity: 1;
  transform: none;
}

.tucfo__prop small,
.tucfo__caja small {
  display: block;
  margin-bottom: 4px;
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.tucfo__linea {
  margin-bottom: 10px;
  font-weight: 600;
}

/* Tarjeta «Nuevo ingreso»: una fila por dato, sin Antes/Después, y el total del ejercicio al final */
.tucfo__filas {
  display: grid;
  gap: 2px;
  margin: 0 0 var(--space-3);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

.tucfo__filas div {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 4px 0;
  border-top: 1px solid #EEF3F1;
}

.tucfo__filas div:first-child {
  border-top: 0;
}

.tucfo__filas dt {
  color: var(--text-muted);
}

.tucfo__filas dd {
  margin: 0;
  font-weight: 600;
  text-align: right;
}

/* Tarjeta «Cambiar»: Antes y Después solo en la fila que cambia, y el total del ejercicio */
.tucfo__cambio {
  width: 100%;
  margin: 0 0 var(--space-3);
  border-collapse: collapse;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

.tucfo__cambio th {
  padding: 0 0 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-align: right;
}

.tucfo__cambio td {
  padding: 5px 0 5px 8px;
  border-top: 1px solid #EEF3F1;
  text-align: right;
  white-space: nowrap;
}

.tucfo__cambio td:first-child {
  padding-left: 0;
  color: var(--text-muted);
  text-align: left;
  white-space: normal;
}

.tucfo__cambio td:last-child {
  font-weight: 700;
  color: var(--accent-texto);
}

.tucfo__filas .tucfo__filas-total,
.tucfo__cambio .tucfo__filas-total td {
  font-weight: 700;
}

.tucfo__boton {
  display: inline-flex;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--white);
  font-size: var(--text-sm);
  font-weight: 600;
  transition: transform 0.15s, background 0.15s;
}

.tucfo__boton--sec {
  background: transparent;
  color: var(--text-muted);
}

.tucfo__boton--pulsado {
  transform: scale(0.94);
  background: var(--accent-texto);
}

/* Los puntitos de «escribiendo» van encima del hueco de la respuesta que viene: no ocupan sitio propio */
.tucfo__escribiendo {
  position: absolute;
  left: 0;
  display: none;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.1);
}

.tucfo__escribiendo.tucfo__ver {
  display: inline-flex;
}

.tucfo__escribiendo i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #9FC3BA;
  animation: tucfo-salto 1s infinite;
}

.tucfo__escribiendo i:nth-child(2) {
  animation-delay: 0.15s;
}

.tucfo__escribiendo i:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes tucfo-salto {
  0%, 60%, 100% { transform: none; opacity: 0.5; }
  30% { transform: translateY(-3px); opacity: 1; }
}

.tucfo__prueba small {
  display: block;
  margin-bottom: var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  color: #9FC3BA;
}

.tucfo__chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.tucfo__chip {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--white);
  color: var(--primary);
  font-size: var(--text-sm);
}

.tucfo__chip--sec {
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: transparent;
  color: #E8F2EF;
}

.tucfo__pie {
  margin-top: auto;
}

.tucfo__pie h3 {
  margin: 0 0 6px;
  font-size: 1.5rem;
  letter-spacing: -0.01em;
}

.tucfo__tarjeta--chat .tucfo__pie h3 {
  color: var(--white);
}

.tucfo__pie p {
  margin: 0;
  line-height: 1.6;
}

.tucfo__tarjeta--chat .tucfo__pie p {
  color: #CFE0DB;
}

.tucfo__tarjeta--sim .tucfo__pie p {
  color: var(--text-muted);
}

/* Antes y después: el hueco de la cifra tachada y del «Hecho» está siempre reservado, así nada cambia de tamaño */
.tucfo__sim {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  align-items: center;
}

.tucfo__caja {
  padding: 14px;
  border: 1px solid #DCE7E3;
  border-radius: 14px;
  background: var(--white);
  font-size: var(--text-sm);
  box-shadow: 0 10px 30px -18px rgba(0, 48, 60, 0.35);
}

.tucfo__pide {
  margin-bottom: var(--space-3);
}

.tucfo__pide p {
  margin: 0;
}

.tucfo__hecho {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-2);
  margin-top: 10px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-texto);
}

.tucfo__deshacer {
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: underline;
}

.tucfo--anima .tucfo__hecho {
  visibility: hidden;
}

.tucfo--anima .tucfo__hecho.tucfo__ver {
  visibility: visible;
}

.tucfo__res-titulo {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
  font-weight: 700;
}

.tucfo__estado {
  min-width: 5.5em;
  padding: 2px 8px;
  border-radius: 999px;
  background: #E3F7EF;
  color: var(--accent-texto);
  font-size: 11px;
  font-weight: 600;
  text-align: center;
}

.tucfo__fila {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  padding: 7px 0;
  border-top: 1px solid #EEF3F1;
}

.tucfo__fila:first-of-type {
  border-top: 0;
}

.tucfo__fila > span:first-child {
  color: var(--text-muted);
}

.tucfo__valor {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  min-width: 6.5em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.tucfo__valor b {
  transition: color 0.4s;
}

.tucfo__valor s {
  font-size: var(--text-xs);
  color: #A3B1AD;
  visibility: hidden;
}

.tucfo__valor--sube b {
  color: var(--accent-texto);
}

.tucfo__valor--sube s {
  visibility: visible;
}

.tucfo__cta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: var(--space-3) var(--space-5);
  margin-top: var(--space-8);
  text-align: center;
}

.tucfo__cta span {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

@media (max-width: 900px) {
  .tucfo__cab,
  .tucfo__tarjetas,
  .tucfo__sim {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .tucfo {
    padding: var(--space-12, 3rem) 0;
  }

  .tucfo__tarjeta {
    padding: var(--space-5);
    border-radius: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tucfo__globo,
  .tucfo__prop {
    transition: none;
  }

  .tucfo__escribiendo i {
    animation: none;
  }
}
