/* SELECTOR DE SEXO */
.sexo-selector {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.2rem;
}

.sexo-btn {
    flex: 1;
    padding: 0.55rem 1rem;
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-soft);
    font-family: var(--font-primary);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
    text-align: center;
    white-space: nowrap;
}

.sexo-btn.active {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

/* BARRA VISUAL DE TALLA IDEAL */
.talla-barra-wrap {
    margin: 1rem 0 0.5rem;
}

.talla-barra-outer {
    position: relative;
    height: 24px;
    border-radius: 12px;
    background: var(--border-color);
    overflow: visible;
}

.talla-barra-rango {
    position: absolute;
    top: 0;
    height: 100%;
    background: #bfdbfe;
    border-radius: 12px;
    transition: left .5s ease, width .5s ease;
}

.talla-barra-needle {
    position: absolute;
    top: -5px;
    width: 4px;
    height: 34px;
    background: #1e293b;
    border-radius: 2px;
    transform: translateX(-50%);
    transition: left .5s ease;
}

.talla-barra-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 0.4rem;
    font-family: var(--font-primary);
    font-size: 0.72rem;
    color: var(--text-muted);
}

.talla-barra-legend {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 0.3rem;
    font-family: var(--font-primary);
    font-size: 0.74rem;
}

@media (max-width: 479px) {
    .talla-barra-legend {
        gap: 0.4rem 0.6rem;
        font-size: 0.68rem;
    }
}

/* TARJETAS DE FÓRMULAS */
.formulas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 0.7rem;
    margin-top: 0.5rem;
}

@media (max-width: 359px) {
    .formulas-grid {
        grid-template-columns: 1fr;
    }
}

.formula-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.9rem 1rem;
    text-align: center;
    transition: border-color var(--transition);
    min-width: 0;
    overflow: hidden;
}

@media (max-width: 479px) {
    .formula-card {
        padding: 0.7rem 0.6rem;
    }
}

.formula-card.destacada {
    border-color: var(--primary-color);
    background: #eff6ff;
}

.formula-nombre {
    font-family: var(--font-primary);
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.3rem;
}

.formula-valor {
    font-family: var(--font-primary);
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-color);
}

@media (max-width: 479px) {
    .formula-valor {
        font-size: 1.15rem;
    }
}

.formula-card.destacada .formula-valor {
    color: var(--primary-color);
}

.formula-diff {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

/* TABLA RANGO IMC */
.tabla-rango {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
    font-family: var(--font-primary);
}

.tabla-rango th {
    background: var(--bg-soft);
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    padding: 0.5rem 0.8rem;
    text-align: right;
    border-bottom: 2px solid var(--border-color);
}

.tabla-rango th:first-child {
    text-align: left;
}

.tabla-rango td {
    padding: 0.45rem 0.8rem;
    text-align: right;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-color);
    white-space: nowrap;
}

.tabla-rango td:first-child {
    text-align: left;
    white-space: normal;
}

@media (max-width: 479px) {

    .tabla-rango th,
    .tabla-rango td {
        padding: 0.4rem 0.5rem;
        font-size: 0.75rem;
    }

    .tabla-rango th {
        font-size: 0.65rem;
        white-space: normal;
        min-width: 50px;
    }

    .tabla-rango td:first-child {
        min-width: 90px;
    }
}

.tabla-rango tr.fila-actual td {
    background: #eff6ff;
    font-weight: 700;
    color: var(--primary-color);
}

.tabla-wrap {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    -webkit-overflow-scrolling: touch;
}

.cat-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    margin-right: 5px;
    vertical-align: middle;
}

/* GRÁFICO SVG (#chartSvg) */
#chartSvg {
    display: block;
    min-width: 0;
}

@media (max-width: 479px) {

    #chartSvg {
        min-width: 420px;
        min-height: 190px;
    }

    #chartSection {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
}

/* LEYENDA DEL GRÁFICO (.chart-legend) */
.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 0.75rem;
    margin-top: 0.75rem;
    font-family: var(--font-primary);
    font-size: 0.76rem;
    color: var(--text-muted);
}

.chart-legend span {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    white-space: nowrap;
}

.chart-legend .dot {
    flex-shrink: 0;
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

@media (max-width: 479px) {
    .chart-legend {
        gap: 0.35rem 0.5rem;
        font-size: 0.7rem;
    }
}

/* INDICADOR IDEAL */
.ideal-indicator {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem 1.2rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-soft);
    margin-top: 1rem;
}

.ideal-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.ideal-icon.bajo {
    background: #dbeafe;
    color: #2563eb;
}

.ideal-icon.ideal {
    background: #d1fae5;
    color: #059669;
}

.ideal-icon.sobre {
    background: #fef3c7;
    color: #d97706;
}

.ideal-icon.obeso {
    background: #fee2e2;
    color: #dc2626;
}

.ideal-verdict {
    font-family: var(--font-primary);
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-color);
    min-width: 0;
    overflow-wrap: break-word;
}

.ideal-verdict span {
    display: block;
    font-weight: 400;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.1rem;
}

@media (max-width: 479px) {
    .ideal-indicator {
        padding: 0.7rem 0.85rem;
        gap: 0.6rem;
    }

    .ideal-verdict {
        font-size: 0.82rem;
    }

    .ideal-verdict span {
        font-size: 0.75rem;
    }
}

/* PREDICTOR DE ALTURA HIJOS  */
.predictor-card {
    background: var(--bg-soft);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.4rem;
}

.predictor-card h3 {
    font-family: var(--font-primary);
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.pred-result {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.7rem;
    margin-top: 1rem;
}

@media (max-width: 359px) {
    .pred-result {
        grid-template-columns: 1fr;
    }
}

.pred-item {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.9rem;
    text-align: center;
    min-width: 0;
    overflow: hidden;
}

.pred-item.nino {
    border-color: #2563eb;
    background: #eff6ff;
}

.pred-item.nina {
    border-color: #db2777;
    background: #fdf2f8;
}

.pred-label {
    font-family: var(--font-primary);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
}

.pred-valor {
    font-family: var(--font-primary);
    font-size: 1.6rem;
    font-weight: 700;
}

@media (max-width: 479px) {
    .pred-valor {
        font-size: 1.35rem;
    }

    .predictor-card {
        padding: 1rem;
    }
}

.pred-item.nino .pred-valor {
    color: #2563eb;
}

.pred-item.nina .pred-valor {
    color: #db2777;
}

.pred-rango {
    font-family: var(--font-primary);
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
    word-break: break-word;
}

/* DISCLAIMER */
.disclaimer {
    background: #fef9ec;
    border-left: 3px solid #d97706;
    border-radius: 0 6px 6px 0;
    padding: 0.7rem 1rem;
    font-family: var(--font-primary);
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 1.2rem;
}