/* ========================================================
   CieloSKIN - Sistema de Estilos & Tipografía Editorial (styles.css)
   Tipografía Display Oficial: Fraunces (Curvas Orgánicas & Lujo Editorial)
   Tipografía UI: Plus Jakarta Sans (Precisión Técnica & Legibilidad)
   ======================================================== */

@import url("https://fonts.googleapis.com/css2?family=Bodoni+Moda:ital,opsz,wght@0,6..96,400..900;1,6..96,400..900&family=Fraunces:ital,opsz,wght,SOFT@0,9..144,300..900,0..100;1,9..144,300..900,0..100&family=Plus+Jakarta+Sans:ital,wght@0,300..800;1,300..800&display=swap");

:root {
  /* Identidad CieloSkin Base */
  --primary: #8c2e2e; /* Borgoña Firma */
  --primary-hover: #732424;

  /* Esencia Azul Cielo de la Marca */
  --cielo-blue: #7cb9e8; /* Azul Cielo Firma */
  --cielo-soft: #a4ceea; /* Azul Mineral Oficial Guía */
  --cielo-mist: #eef6fc; /* Bruma Celestial */
  --cielo-deep: #1e6091; /* Azul Zafiro Profundo */

  /* Paleta Vibrant Pop & Skincare Moderno */
  --pop-coral: #ff5e62; /* Coral Neón / Frambuesa Eléctrico */
  --pop-peach: #ff9966; /* Melocotón Luminoso */
  --pop-electric-cyan: #00c6ff; /* Cian / Aqua Eléctrico */
  --pop-cyan-deep: #0072ff; /* Azul Eléctrico */
  --pop-violet: #8e2de2; /* Violeta / Púrpura Ultraviolet */
  --pop-fuchsia: #f000ff; /* Fucsia Magenta Neón */
  --pop-lime: #00f260; /* Lima Neón / Acid Kiwi */
  --pop-yellow: #ffc837; /* Amarillo Sol / Mango Punch */

  /* Gradientes Dinámicos de Alto Impacto */
  --grad-sunset: linear-gradient(135deg, #ff5e62 0%, #ff9966 100%);
  --grad-berry: linear-gradient(135deg, #8c2e2e 0%, #ff5e62 100%);
  --grad-electric: linear-gradient(135deg, #00c6ff 0%, #0072ff 100%);
  --grad-aurora: linear-gradient(135deg, #8e2de2 0%, #f000ff 100%);
  --grad-lime-cyan: linear-gradient(135deg, #0575e6 0%, #00f260 100%);
  --grad-peach-yellow: linear-gradient(135deg, #ff9966 0%, #ffc837 100%);
  --grad-cielo: linear-gradient(135deg, #7cb9e8 0%, #00c6ff 100%);

  /* Fondos y Neutros con Frescura Celestial */
  --bg-cream: #f7fafd;
  --bg-vibrant: #f2f8fd;
  --card-bg: #ffffff;
  --text-main: #1f272e;
  --text-muted: #5e6f7d;
  --border-subtle: #dbeaf4;
  --border-focus: #7cb9e8;

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-pill: 9999px;

  --shadow-subtle: 0 4px 20px rgba(30, 96, 145, 0.05);
  --shadow-card: 0 16px 40px rgba(30, 96, 145, 0.08);
  --shadow-pop: 0 10px 28px rgba(255, 94, 98, 0.28);
  --shadow-pop-cyan: 0 10px 28px rgba(0, 198, 255, 0.28);
  --shadow-pop-violet: 0 10px 28px rgba(142, 45, 226, 0.28);

  /* Sistema Tipográfico */
  --font-display: "Fraunces", "Bodoni Moda", Georgia, serif;
  --font-body:
    "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    sans-serif;
}

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

body {
  font-family: var(--font-body);
  background-color: var(--bg-cream);
  background-image:
    radial-gradient(at 0% 0%, rgba(124, 185, 232, 0.22) 0px, transparent 55%),
    radial-gradient(at 100% 0%, rgba(0, 198, 255, 0.15) 0px, transparent 50%),
    radial-gradient(at 50% 40%, rgba(255, 255, 255, 0.75) 0px, transparent 65%),
    radial-gradient(at 100% 100%, rgba(164, 206, 234, 0.2) 0px, transparent 55%),
    radial-gradient(at 0% 100%, rgba(255, 153, 102, 0.07) 0px, transparent 45%);
  background-attachment: fixed;
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Encabezados Editoriales */
h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-variation-settings: "SOFT" 60;
  color: var(--primary);
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* ========================================================
   Header & Navegación
   ======================================================== */
header {
  background-color: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 2px solid rgba(164, 206, 234, 0.5);
  padding: 16px 28px;
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 0 4px 20px rgba(30, 96, 145, 0.06);
}

.header-inner {
  max-width: 1020px;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.header-logo-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  outline: none;
}

.header-logo {
  height: 68px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  display: block;
  transition:
    transform 0.25s ease,
    opacity 0.25s ease;
}

.header-logo:hover {
  transform: scale(1.03);
  opacity: 0.95;
}

.nav-back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--dark-brown);
  text-decoration: none;
  font-family: var(--font-body);
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  background: var(--bg-cream);
  border: 1px solid #ebdcd9;
  transition: all 0.25s ease;
}

.nav-back-link:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: #ffffff;
  transform: translateX(-2px);
}

.nav-back-link svg {
  width: 15px;
  height: 15px;
  transition: transform 0.2s ease;
}

.nav-back-link:hover svg {
  transform: translateX(-3px);
}

/* ========================================================
   Contenedores Principales
   ======================================================== */
main {
  flex: 1;
}

.container-narrow {
  max-width: 640px;
  margin: 40px auto 70px auto;
  padding: 0 20px;
}

.container-wide {
  max-width: 1020px;
  margin: 40px auto 80px auto;
  padding: 0 20px;
}

/* ========================================================
   Formulario de Acceso (Gate)
   ======================================================== */
.gate-container {
  background: var(--card-bg);
  padding: 46px 40px;
  border-radius: var(--radius-lg);
  box-shadow:
    0 16px 40px rgba(140, 46, 46, 0.07),
    0 2px 8px rgba(0, 0, 0, 0.03);
  text-align: center;
  border: 1px solid #f0e6e4;
  border-top: 4px solid #ff5e62;
  animation: fadeIn 0.4s ease-out;
  position: relative;
}

.gate-icon-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px auto;
}

.gate-icon {
  width: 76px;
  height: 76px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 8px 18px rgba(255, 94, 98, 0.25));
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.gate-icon:hover {
  transform: scale(1.12) rotate(-6deg);
}

.gate-container h2 {
  font-size: 2.6rem;
  letter-spacing: -0.01em;
  background: linear-gradient(135deg, #8c2e2e 0%, #ff5e62 70%, #ff9966 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
  margin-bottom: 8px;
  line-height: 1.15;
  font-weight: 600;
}

.gate-subtitle {
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 30px;
  line-height: 1.5;
}

/* ========================================================
   Preguntas del Formulario & Opciones
   ======================================================== */
.form-info-notice {
  background: rgba(0, 198, 255, 0.06);
  border: 1px solid rgba(0, 198, 255, 0.25);
  border-left: 4px solid #00c6ff;
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 20px;
  text-align: left;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.form-info-notice .info-icon {
  font-size: 1.25rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 2px;
}

.form-info-notice strong {
  display: block;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 700;
  color: #0077b6;
  margin-bottom: 4px;
}

.form-info-notice p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-dark);
  line-height: 1.5;
}

.form-question-card {
  background: #fdfcfb;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 22px;
  margin-bottom: 18px;
  text-align: left;
  transition:
    border-color 0.2s,
    box-shadow 0.2s,
    background-color 0.2s;
}

.form-question-card:focus-within {
  border-color: var(--rose);
  background-color: #ffffff;
  box-shadow: 0 4px 16px rgba(217, 127, 119, 0.12);
}

.question-header {
  margin-bottom: 14px;
}

.question-title {
  font-family: var(--font-body);
  font-size: 0.96rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  line-height: 1.4;
}

.question-title .required {
  color: var(--primary);
  font-weight: 700;
  margin-left: 4px;
}

.question-subtext {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.4;
}

/* Botones de Redes Sociales */
.social-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  text-decoration: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  margin-left: auto;
}

.social-link-btn.youtube-btn {
  background-color: #e62117;
  color: #ffffff;
}

.social-link-btn.youtube-btn:hover {
  background-color: #c4180f;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(230, 33, 23, 0.3);
}

.social-link-btn.instagram-btn {
  background: linear-gradient(
    45deg,
    #f09433 0%,
    #e6683c 25%,
    #dc2743 50%,
    #cc2366 75%,
    #bc1888 100%
  );
  color: #ffffff;
}

.social-link-btn.instagram-btn:hover {
  filter: brightness(1.1);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(220, 39, 67, 0.3);
}

.social-link-btn svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

/* Opciones de Selección */
.options-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option-tile {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #ffffff;
  border: 1.5px solid #e7dcda;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-main);
  transition: all 0.2s ease;
  user-select: none;
}

.option-tile:hover {
  border-color: #ff5e62;
  background: #fff8f8;
  transform: translateX(3px);
}

.option-tile input[type="radio"],
.option-tile input[type="checkbox"] {
  accent-color: #ff5e62;
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.option-tile:has(input:checked) {
  border-color: #ff5e62;
  background: linear-gradient(
    90deg,
    rgba(255, 94, 98, 0.08) 0%,
    rgba(255, 153, 102, 0.05) 100%
  );
  font-weight: 700;
  color: #c72c41;
  box-shadow: 0 4px 14px rgba(255, 94, 98, 0.12);
}

/* Grilla de Fórmulas */
.checkbox-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 540px) {
  .checkbox-grid {
    grid-template-columns: 1fr;
  }
}

/* Inputs de Texto y Email */
.form-group {
  margin-bottom: 18px;
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--dark-brown);
  margin-bottom: 6px;
  font-weight: 700;
}

.form-group input {
  width: 100%;
  padding: 13px 16px;
  border: 1.5px solid #e0d6d3;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.95rem;
  outline: none;
  background-color: #ffffff;
  color: var(--text-main);
  transition:
    border-color 0.25s,
    box-shadow 0.25s;
}

.form-group input:focus {
  border-color: var(--rose);
  box-shadow: 0 0 0 3px rgba(217, 127, 119, 0.15);
}

.form-alert {
  display: none;
  background: #fff2f1;
  border: 1px solid #f5b7b1;
  color: #922b21;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  margin-bottom: 20px;
  text-align: left;
  line-height: 1.4;
  font-weight: 500;
}

.form-alert.visible {
  display: block;
}

/* Botones Principales */
.btn-primary {
  width: 100%;
  background: var(--grad-sunset);
  color: white;
  border: none;
  padding: 15px 24px;
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.25s ease,
    filter 0.25s ease;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  box-shadow: var(--shadow-pop);
}

.btn-primary:hover {
  filter: brightness(1.08);
  transform: translateY(-3px) scale(1.01);
  box-shadow: 0 14px 32px rgba(255, 94, 98, 0.4);
}

.btn-primary:active {
  transform: translateY(-1px) scale(0.99);
}

.btn-secondary {
  background: #ffffff;
  border: 2px solid #ff5e62;
  color: #ff5e62;
  padding: 10px 22px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  transition: all 0.25s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.btn-secondary:hover {
  background: var(--grad-sunset);
  color: white;
  border-color: transparent;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 94, 98, 0.25);
}

/* ========================================================
   Catálogo de Fórmulas (Hub)
   ======================================================== */
.catalog-header {
  text-align: center;
  margin-bottom: 38px;
}

.welcome-heading-wrapper {
  margin-bottom: 8px;
}

.welcome-title {
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--pop-coral);
  margin: 0 0 8px 0;
}

.welcome-title span {
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  color: inherit;
  letter-spacing: inherit;
}

.catalog-header h1 {
  font-size: 2.8rem;
  color: var(--primary);
  margin-bottom: 8px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.catalog-header p {
  color: var(--text-main);
  opacity: 0.85;
  font-size: 0.98rem;
  line-height: 1.5;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

.user-badge-bar {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: #ffffff;
  padding: 8px 20px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(217, 127, 119, 0.25);
  box-shadow: var(--shadow-subtle);
  margin-bottom: 24px;
  font-size: 0.88rem;
  flex-wrap: wrap;
  justify-content: center;
}

.badge-cta-btn {
  background: var(--grad-sunset);
  color: #ffffff;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-weight: 700;
  font-size: 0.8rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  box-shadow: 0 4px 12px rgba(255, 94, 98, 0.25);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.badge-cta-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(255, 94, 98, 0.35);
  color: #ffffff;
}

.user-badge-bar strong {
  color: var(--primary);
  font-weight: 700;
}

.user-badge-bar button,
.badge-logout-btn {
  background: none;
  border: none;
  color: var(--pop-coral);
  text-decoration: underline;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  font-family: var(--font-body);
  transition: opacity 0.2s;
}

.user-badge-bar button:hover,
.badge-logout-btn:hover {
  opacity: 0.8;
}

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

.formula-card-preview {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  border: 1px solid var(--border-subtle);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
  transition:
    transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.3s ease,
    border-color 0.3s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.formula-card-preview::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #7cb9e8, #00c6ff, #a4ceea);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.formula-card-preview:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 40px rgba(124, 185, 232, 0.22);
  border-color: rgba(124, 185, 232, 0.6);
}

.formula-card-preview:hover::before {
  opacity: 1;
}

.formula-card-preview.disabled {
  opacity: 0.65;
  background: #faf7f6;
  cursor: not-allowed;
}

.formula-card-preview.disabled:hover {
  transform: none;
  box-shadow: var(--shadow-subtle);
  border-color: var(--border-subtle);
}

.card-tag {
  display: inline-block;
  align-self: flex-start;
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  background: rgba(164, 206, 234, 0.35);
  color: var(--dark-brown);
  margin-bottom: 14px;
}

.card-tag.available {
  background: var(--grad-sunset);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(255, 94, 98, 0.3);
}

.card-tag.tag-oil {
  background: var(--grad-peach-yellow);
  color: #522700;
  box-shadow: 0 4px 12px rgba(255, 200, 55, 0.3);
}

.card-tag.tag-balm {
  background: var(--grad-aurora);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(142, 45, 226, 0.3);
}

.card-tag.tag-electric {
  background: var(--grad-electric);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(0, 198, 255, 0.3);
}

.card-tag.tag-lime {
  background: var(--grad-lime-cyan);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(0, 242, 96, 0.3);
}

.card-tag.soon {
  background: #eee6e4;
  color: #8c7f7c;
}

.formula-card-preview h3 {
  font-size: 1.85rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 10px;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.formula-card-preview p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 24px;
  line-height: 1.5;
}

.formula-card-preview .card-action {
  margin-top: auto;
}

/* ========================================================
   Página de Fórmula Individual
   ======================================================== */
.welcome-banner {
  text-align: center;
  margin-bottom: 38px;
}

.welcome-banner .greeting-label {
  display: block;
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--pop-coral);
  margin-bottom: 8px;
}

.welcome-banner h1 {
  font-size: 2.3rem;
  font-weight: 600;
  color: var(--primary);
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin-bottom: 0;
}

.welcome-banner p:not(.greeting-label) {
  color: var(--text-main);
  opacity: 0.82;
  font-size: 0.95rem;
  line-height: 1.5;
  margin-top: 10px;
  max-width: 820px;
  margin-left: auto;
  margin-right: auto;
  white-space: normal;
}

.formula-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow:
    0 16px 40px rgba(140, 46, 46, 0.06),
    0 2px 8px rgba(0, 0, 0, 0.03);
  border: 1px solid #f0e6e4;
  border-top: 4px solid #ff5e62;
  margin-bottom: 30px;
  position: relative;
}

.formula-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #f6eeee;
  padding-bottom: 22px;
  margin-bottom: 26px;
  flex-wrap: wrap;
  gap: 15px;
}

.formula-title {
  font-size: 2.3rem;
  font-weight: 600;
  background: linear-gradient(135deg, #8c2e2e 0%, #ff5e62 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.batch-calculator {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(
    135deg,
    rgba(0, 198, 255, 0.08) 0%,
    rgba(142, 45, 226, 0.08) 100%
  );
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  border: 1.5px solid rgba(0, 198, 255, 0.4);
  box-shadow: 0 4px 14px rgba(0, 198, 255, 0.12);
}

.batch-calculator label {
  font-size: 0.85rem;
  font-weight: 700;
  color: #1f1b1a;
  white-space: nowrap;
}

.batch-input-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.batch-calculator input {
  width: 110px;
  padding: 6px 24px 6px 12px;
  border: 2px solid #ff5e62;
  border-radius: var(--radius-pill);
  text-align: right;
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 16px;
  color: #ff5e62;
  background: #ffffff;
  outline: none;
  box-shadow: 0 2px 8px rgba(255, 94, 98, 0.2);
  box-sizing: border-box;
}

.batch-calculator input:focus {
  border-color: #00c6ff;
  box-shadow: 0 0 0 3px rgba(0, 198, 255, 0.25);
}

.batch-input-suffix {
  position: absolute;
  right: 10px;
  font-size: 0.92rem;
  font-weight: 800;
  color: #ff5e62;
  pointer-events: none;
  user-select: none;
}

.batch-done-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #00c6ff 0%, #0072ff 100%);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-pill);
  padding: 7px 15px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 198, 255, 0.3);
  transition: transform 0.15s ease, opacity 0.15s ease;
  line-height: 1;
  white-space: nowrap;
}

.batch-done-btn:active {
  transform: scale(0.95);
  opacity: 0.9;
}

.table-container {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 24px;
  border-radius: var(--radius-md);
  border: 1px solid #f0e6e4;
  background: #ffffff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  margin-bottom: 0;
  background: #ffffff;
  border: none;
  border-radius: 0;
  table-layout: auto;
}

th {
  background-color: #fcf9f8;
  color: var(--text-muted);
  text-align: left;
  padding: 10px 8px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: var(--font-body);
  border-bottom: 1.5px solid #ece2e0;
  white-space: normal;
}

td {
  padding: 12px 10px;
  border-bottom: 1px solid #f6f0ef;
  font-size: 0.88rem;
  color: var(--text-main);
  vertical-align: middle;
}

/* Optimización específica de columnas para que no se aprieten */
/* Col 1: Ingrediente */
th:nth-child(1),
td:nth-child(1) {
  width: 35%;
  word-break: break-word;
}

/* Col 2: Función */
th:nth-child(2) {
  width: 38%;
}

td:nth-child(2) {
  width: 38%;
  word-break: break-word;
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* Col 3: Porcentaje */
th:nth-child(3),
td:nth-child(3) {
  width: 12%;
  text-align: right;
  white-space: nowrap;
  padding-left: 4px;
  padding-right: 4px;
}

/* Col 4: Gramos */
th:nth-child(4),
td:nth-child(4) {
  width: 15%;
  text-align: right;
  white-space: nowrap;
  min-width: 52px;
  padding-right: 10px;
  padding-left: 4px;
}

th:nth-child(4) {
  color: #ff5e62;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover:not(.phase-header) {
  background-color: #fffbfa;
}

.calc-g {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #ff5e62;
  font-size: 0.96rem;
}

/* Encabezados de Fase (Separadores de Sección Nítidos) */
.phase-header {
  background: #fbf6f5;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.76rem;
  font-family: var(--font-body);
}

.phase-header td {
  padding: 11px 18px;
  font-weight: 800;
  border-top: 1.5px solid #ebdcd9;
  border-bottom: 1.5px solid #ebdcd9;
}

.phase-header.phase-a td {
  background-color: rgba(255, 94, 98, 0.08);
  color: #cf3341;
  border-left: 4px solid #ff5e62;
}

.phase-header.phase-b td {
  background-color: rgba(0, 198, 255, 0.08);
  color: #0077b6;
  border-left: 4px solid #00c6ff;
}

.phase-header.phase-c td {
  background-color: rgba(142, 45, 226, 0.08);
  color: #6a1b9a;
  border-left: 4px solid #8e2de2;
}

.phase-header.phase-d td {
  background-color: rgba(0, 242, 96, 0.08);
  color: #00897b;
  border-left: 4px solid #00f260;
}

.phase-header.phase-e td {
  background-color: rgba(255, 179, 0, 0.08);
  color: #b26a00;
  border-left: 4px solid #ffb300;
}

.method-steps,
.tips-section {
  margin-top: 36px;
}

.tips-section {
  background: linear-gradient(
    135deg,
    rgba(255, 200, 55, 0.12) 0%,
    rgba(255, 153, 102, 0.1) 100%
  );
  border: 2px solid rgba(255, 153, 102, 0.35);
  border-left: 6px solid #ff9966;
  padding: 26px 30px;
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(255, 153, 102, 0.12);
}

.tips-section h3 {
  color: #d35400;
  display: flex;
  align-items: center;
  gap: 8px;
}

.method-steps h3,
.tips-section h3 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 14px;
  letter-spacing: -0.01em;
}

.method-steps ol,
.tips-section ul {
  padding-left: 22px;
}

.method-steps li,
.tips-section li {
  margin-bottom: 10px;
  color: var(--text-main);
  line-height: 1.6;
}

.actions-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 34px;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

/* ========================================================
   Footer
   ======================================================== */
footer {
  text-align: center;
  padding: 28px 20px;
  color: var(--text-muted);
  font-size: 0.82rem;
  margin-top: auto;
}

/* ========================================================
   Animaciones
   ======================================================== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========================================================
   Responsive — Tablet (≤ 900px)
   ======================================================== */
@media (max-width: 900px) {
  .container-wide {
    padding: 0 24px;
  }

  .catalog-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 18px;
  }

  .formula-card {
    padding: 32px 28px;
  }

  .formula-title {
    font-size: 2rem;
  }

  .welcome-banner h1 {
    font-size: 2.4rem;
  }

  .catalog-header h1 {
    font-size: 2.3rem;
  }
}

/* ========================================================
   Responsive — Mobile (≤ 650px)
   ======================================================== */
@media (max-width: 650px) {
  /* Header */
  header {
    padding: 12px 18px;
  }

  .header-logo {
    height: 48px;
  }

  /* Nav back link shortens */
  .nav-back-link {
    font-size: 0.78rem;
    padding: 6px 12px;
  }

  /* Narrow container fills screen */
  .container-narrow {
    margin: 16px 0 48px 0;
    padding: 0 12px;
  }

  .container-wide {
    margin: 16px 0 48px 0;
    padding: 0 14px;
  }

  /* Gate form card */
  .gate-container {
    padding: 28px 18px;
    border-radius: var(--radius-md);
    margin: 0;
  }

  .gate-icon {
    width: 58px;
    height: 58px;
  }

  .gate-container h2 {
    font-size: 1.9rem;
    line-height: 1.2;
  }

  .gate-subtitle {
    font-size: 0.88rem;
    margin-bottom: 22px;
  }

  /* Form question cards */
  .form-question-card {
    padding: 16px 14px;
    margin-bottom: 14px;
  }

  .question-title {
    font-size: 0.9rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .social-link-btn {
    width: 100%;
    justify-content: center;
    margin-left: 0;
  }

  /* Checkbox grid → single column */
  .checkbox-grid {
    grid-template-columns: 1fr;
  }

  /* Submit button */
  .btn-primary {
    font-size: 0.82rem;
    padding: 14px 18px;
    letter-spacing: 0.06em;
  }

  /* Catalog */
  .catalog-header h1 {
    font-size: 2rem;
  }

  .welcome-title {
    font-size: 0.95rem;
  }

  .welcome-title span {
    font-size: inherit;
  }

  .catalog-header p {
    font-size: 0.88rem;
  }

  .user-badge-bar {
    flex-direction: column;
    gap: 6px;
    text-align: center;
    padding: 10px 14px;
    font-size: 0.82rem;
    width: 100%;
  }

  .catalog-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .formula-card-preview {
    padding: 22px 18px;
    border-radius: var(--radius-md);
  }

  .formula-card-preview h3 {
    font-size: 1.5rem;
  }

  /* Formula page */
  .welcome-banner h1 {
    font-size: 1.9rem;
  }

  .welcome-banner p {
    font-size: 0.88rem;
  }

  .formula-card {
    padding: 20px 14px;
    border-radius: var(--radius-md);
  }

  .formula-header {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    padding-bottom: 16px;
    margin-bottom: 18px;
  }

  .formula-title {
    font-size: 1.65rem;
    text-align: center;
  }

  /* Calculadora de Lote Móvil: centrada, sin saltos y con tamaño amplio para que 200/500/1000 nunca se corten */
  .batch-calculator {
    width: 100%;
    max-width: 100%;
    justify-content: center;
    border-radius: var(--radius-pill);
    padding: 7px 10px;
    box-sizing: border-box;
    gap: 8px;
    flex-wrap: nowrap;
  }

  .batch-calculator label {
    font-size: 0.82rem;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .batch-input-wrapper {
    flex-shrink: 0;
  }

  .batch-calculator input {
    width: 86px;
    min-width: 86px;
    font-size: 16px !important; /* CRÍTICO: Previene el auto-zoom en iPhone / iOS Safari */
    padding: 6px 22px 6px 10px;
    box-sizing: border-box;
  }

  .batch-input-suffix {
    right: 9px;
    font-size: 0.92rem;
    font-weight: 800;
  }

  .batch-done-btn {
    padding: 7px 14px;
    font-size: 0.82rem;
    font-weight: 700;
    flex-shrink: 0;
  }

  /* ========================================================
     TABLA DE FÓRMULA MÓVIL (100% RESPONSIVA, CON % Y GRAMOS)
     - Preserva las 4 columnas esenciales: Ingrediente, Función, % y Gramos
     - La columna de porcentaje (%) se mantiene siempre visible y alineada
     - Permite scroll horizontal fluido de seguridad si la pantalla es ultra angosta
     ======================================================== */
  .table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-md);
    border: 1px solid #f0e6e4;
    background: #ffffff;
    margin-bottom: 20px;
  }

  table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
  }

  /* Encabezados unificados: misma tipografía, tamaño y peso */
  th {
    padding: 10px 4px;
    font-family: var(--font-body);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-muted);
    background-color: #fcf9f8;
    border-bottom: 1.5px solid #ece2e0;
    white-space: nowrap;
    vertical-align: middle;
  }

  /* Encabezado 1: Ingrediente */
  th:nth-child(1) {
    width: 38%;
    font-size: 0.68rem;
    text-align: left;
    padding-left: 8px;
  }

  /* Encabezado 2: Función */
  th:nth-child(2) {
    width: 30%;
    font-size: 0.68rem;
    text-align: left;
    padding-left: 4px;
  }

  /* Encabezado 3: % (Centrado en su columna) */
  th:nth-child(3) {
    width: 14%;
    font-size: 0.68rem;
    text-align: center;
    padding-left: 2px;
    padding-right: 2px;
  }

  /* Encabezado 4: Gramos (Mismo tamaño que el resto, color coral coordinado) */
  th:nth-child(4) {
    width: 18%;
    font-size: 0.68rem;
    text-align: right;
    padding-right: 8px;
    color: #ff5e62;
  }

  /* Celdas de datos */
  td {
    padding: 10px 4px;
    border-bottom: 1px solid #f6f0ef;
    vertical-align: middle;
  }

  /* Celda 1: Ingrediente — sin partir palabras en sílabas extrañas, salta de renglón limpio */
  td:nth-child(1) {
    width: 38%;
    padding-left: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-main);
    line-height: 1.25;
    word-break: normal;
    overflow-wrap: break-word;
    hyphens: none;
  }

  /* Celda 2: Función */
  td:nth-child(2) {
    width: 30%;
    padding-left: 4px;
    padding-right: 4px;
    font-size: 0.74rem;
    color: var(--text-muted);
    line-height: 1.25;
    word-break: normal;
    overflow-wrap: break-word;
    hyphens: none;
  }

  /* Celda 3: Porcentaje % (Centrado, alineado con su encabezado) */
  td:nth-child(3) {
    width: 14%;
    text-align: center;
    white-space: nowrap;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
  }

  /* Celda 4: Gramos (Destacado en coral, tamaño armónico) */
  td:nth-child(4) {
    width: 18%;
    text-align: right;
    white-space: nowrap;
    font-size: 0.88rem;
    font-weight: 800;
    color: #ff5e62;
    font-variant-numeric: tabular-nums;
    padding-right: 8px;
  }

  /* Encabezado de Fase (ej. FASE A) */
  .phase-header td {
    padding: 8px 10px;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.06em;
  }

  .method-steps,
  .tips-section {
    margin-top: 24px;
  }

  .tips-section {
    padding: 18px 16px;
  }

  .method-steps h3,
  .tips-section h3 {
    font-size: 1.25rem;
  }

  .method-steps li,
  .tips-section li {
    font-size: 0.9rem;
    margin-bottom: 8px;
  }

  /* Actions bar stacks */
  .actions-bar {
    flex-direction: column;
    gap: 10px;
  }

  .actions-bar .btn-secondary,
  .actions-bar .btn-primary {
    width: 100%;
    justify-content: center;
  }

  footer {
    padding: 20px 16px;
    font-size: 0.78rem;
  }
}

/* ========================================================
   Responsive — Small Mobile (≤ 480px)
   ======================================================== */
@media (max-width: 480px) {
  .gate-container h2 {
    font-size: 1.65rem;
  }

  .gate-icon {
    width: 50px;
    height: 50px;
  }

  .option-tile {
    padding: 11px 12px;
    font-size: 0.88rem;
  }

  .formula-title {
    font-size: 1.45rem;
  }

  .welcome-banner h1 {
    font-size: 1.65rem;
  }

  .catalog-header h1 {
    font-size: 1.75rem;
  }

  .batch-calculator label,
  .batch-calculator span {
    font-size: 0.78rem;
  }

  .batch-calculator input {
    width: 84px;
    min-width: 84px;
    font-size: 16px !important;
  }
}

/* ========================================================
   Responsive — Tiny (≤ 360px, iPhone SE, Galaxy S8)
   ======================================================== */
@media (max-width: 360px) {
  header {
    padding: 8px 12px;
  }

  .header-logo {
    height: 32px;
  }

  .gate-container {
    padding: 22px 12px;
  }

  .gate-container h2 {
    font-size: 1.45rem;
  }

  .gate-subtitle {
    font-size: 0.82rem;
  }

  .form-question-card {
    padding: 13px 10px;
  }

  .question-title {
    font-size: 0.84rem;
  }

  .formula-card {
    padding: 14px 10px;
  }

  .formula-title {
    font-size: 1.3rem;
  }

  .welcome-banner h1 {
    font-size: 1.45rem;
  }

  .catalog-header h1 {
    font-size: 1.55rem;
  }

  .batch-calculator {
    padding: 6px 8px;
    gap: 6px;
  }

  .batch-calculator label {
    font-size: 0.76rem;
  }

  .batch-calculator input {
    width: 76px;
    min-width: 76px;
    font-size: 16px !important;
    padding: 5px 18px 5px 6px;
  }

  .batch-input-suffix {
    right: 6px;
    font-size: 0.85rem;
  }

  .batch-done-btn {
    padding: 6px 10px;
    font-size: 0.76rem;
  }
}

/* ========================================================
   Versión para Imprimir / Exportar a PDF
   ======================================================== */
.print-header {
  display: none;
}

@media print {
  body {
    background-color: #ffffff !important;
    color: #000000 !important;
  }

  header,
  .gate-container,
  .batch-calculator,
  .actions-bar,
  .nav-back-link,
  footer {
    display: none !important;
  }

  .print-header {
    display: block !important;
    text-align: center;
    margin-bottom: 24px;
  }

  .print-logo {
    height: 52px;
    width: auto;
    display: block;
    margin: 0 auto 12px auto;
  }

  .container-wide {
    margin: 0 !important;
    padding: 0 !important;
    max-width: 100% !important;
  }

  .formula-card {
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  th {
    background-color: #f5f0ef !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .phase-header {
    background-color: #e5f1f9 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}
